diff --git a/TelegramUI.xcodeproj/project.pbxproj b/TelegramUI.xcodeproj/project.pbxproj index 7e51e86deb..e6e67fb452 100644 --- a/TelegramUI.xcodeproj/project.pbxproj +++ b/TelegramUI.xcodeproj/project.pbxproj @@ -42,6 +42,9 @@ 0962E66121B3512500245FD9 /* WebSearchController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 0962E66021B3512500245FD9 /* WebSearchController.swift */; }; 0962E66321B3513100245FD9 /* WebSearchControllerNode.swift in Sources */ = {isa = PBXBuildFile; fileRef = 0962E66221B3513100245FD9 /* WebSearchControllerNode.swift */; }; 0962E66521B3631100245FD9 /* WebSearchNavigationContentNode.swift in Sources */ = {isa = PBXBuildFile; fileRef = 0962E66421B3631100245FD9 /* WebSearchNavigationContentNode.swift */; }; + 0962E67321B622BE00245FD9 /* PermissionSplitTest.swift in Sources */ = {isa = PBXBuildFile; fileRef = 0962E67221B622BE00245FD9 /* PermissionSplitTest.swift */; }; + 0962E67721B673AF00245FD9 /* Permission.swift in Sources */ = {isa = PBXBuildFile; fileRef = 0962E67621B673AF00245FD9 /* Permission.swift */; }; + 0962E67921B67A9800245FD9 /* ChatMessageAnimatedStickerItemNode.swift in Sources */ = {isa = PBXBuildFile; fileRef = 0962E67821B67A9800245FD9 /* ChatMessageAnimatedStickerItemNode.swift */; }; 096C98BA21787A5C00C211FF /* LegacyBridgeAudio.swift in Sources */ = {isa = PBXBuildFile; fileRef = 096C98B921787A5C00C211FF /* LegacyBridgeAudio.swift */; }; 096C98BF21787C6700C211FF /* TGBridgeAudioEncoder.m in Sources */ = {isa = PBXBuildFile; fileRef = 096C98BB21787C6600C211FF /* TGBridgeAudioEncoder.m */; }; 096C98C021787C6700C211FF /* TGBridgeAudioEncoder.h in Headers */ = {isa = PBXBuildFile; fileRef = 096C98BC21787C6600C211FF /* TGBridgeAudioEncoder.h */; }; @@ -195,6 +198,8 @@ D0430B021FF4584100A35ADD /* WebControllerNode.swift in Sources */ = {isa = PBXBuildFile; fileRef = D0430B011FF4584100A35ADD /* WebControllerNode.swift */; }; D044A0F320BDA05800326FAC /* ThrottledValue.swift in Sources */ = {isa = PBXBuildFile; fileRef = D044A0F220BDA05800326FAC /* ThrottledValue.swift */; }; D044A0FB20BDC40C00326FAC /* CachedChannelAdmins.swift in Sources */ = {isa = PBXBuildFile; fileRef = D044A0FA20BDC40C00326FAC /* CachedChannelAdmins.swift */; }; + D045549A21B2F173007A6DD9 /* libturbojpeg.a in Frameworks */ = {isa = PBXBuildFile; fileRef = D045549921B2F173007A6DD9 /* libturbojpeg.a */; }; + D04554A421B42982007A6DD9 /* ConfirmPhoneNumberController.swift in Sources */ = {isa = PBXBuildFile; fileRef = D04554A321B42982007A6DD9 /* ConfirmPhoneNumberController.swift */; }; D046142E2004DB3700EC0EF2 /* LiveLocationManager.swift in Sources */ = {isa = PBXBuildFile; fileRef = D046142D2004DB3700EC0EF2 /* LiveLocationManager.swift */; }; D04614372005094E00EC0EF2 /* DeviceLocationManager.swift in Sources */ = {isa = PBXBuildFile; fileRef = D04614362005094E00EC0EF2 /* DeviceLocationManager.swift */; }; D0461439200514F000EC0EF2 /* LiveLocationSummaryManager.swift in Sources */ = {isa = PBXBuildFile; fileRef = D0461438200514F000EC0EF2 /* LiveLocationSummaryManager.swift */; }; @@ -1118,6 +1123,9 @@ 0962E66021B3512500245FD9 /* WebSearchController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = WebSearchController.swift; sourceTree = ""; }; 0962E66221B3513100245FD9 /* WebSearchControllerNode.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = WebSearchControllerNode.swift; sourceTree = ""; }; 0962E66421B3631100245FD9 /* WebSearchNavigationContentNode.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = WebSearchNavigationContentNode.swift; sourceTree = ""; }; + 0962E67221B622BE00245FD9 /* PermissionSplitTest.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = PermissionSplitTest.swift; sourceTree = ""; }; + 0962E67621B673AF00245FD9 /* Permission.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = Permission.swift; sourceTree = ""; }; + 0962E67821B67A9800245FD9 /* ChatMessageAnimatedStickerItemNode.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ChatMessageAnimatedStickerItemNode.swift; sourceTree = ""; }; 096C98B921787A5C00C211FF /* LegacyBridgeAudio.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = LegacyBridgeAudio.swift; sourceTree = ""; }; 096C98BB21787C6600C211FF /* TGBridgeAudioEncoder.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = TGBridgeAudioEncoder.m; sourceTree = ""; }; 096C98BC21787C6600C211FF /* TGBridgeAudioEncoder.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = TGBridgeAudioEncoder.h; sourceTree = ""; }; @@ -1393,6 +1401,8 @@ D0430B011FF4584100A35ADD /* WebControllerNode.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = WebControllerNode.swift; sourceTree = ""; }; D044A0F220BDA05800326FAC /* ThrottledValue.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ThrottledValue.swift; sourceTree = ""; }; D044A0FA20BDC40C00326FAC /* CachedChannelAdmins.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = CachedChannelAdmins.swift; sourceTree = ""; }; + D045549921B2F173007A6DD9 /* libturbojpeg.a */ = {isa = PBXFileReference; lastKnownFileType = archive.ar; name = libturbojpeg.a; path = "third-party/libjpeg-turbo/libturbojpeg.a"; sourceTree = ""; }; + D04554A321B42982007A6DD9 /* ConfirmPhoneNumberController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ConfirmPhoneNumberController.swift; sourceTree = ""; }; D046142D2004DB3700EC0EF2 /* LiveLocationManager.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = LiveLocationManager.swift; sourceTree = ""; }; D04614362005094E00EC0EF2 /* DeviceLocationManager.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = DeviceLocationManager.swift; sourceTree = ""; }; D0461438200514F000EC0EF2 /* LiveLocationSummaryManager.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = LiveLocationSummaryManager.swift; sourceTree = ""; }; @@ -2250,6 +2260,7 @@ isa = PBXFrameworksBuildPhase; buildActionMask = 2147483647; files = ( + D045549A21B2F173007A6DD9 /* libturbojpeg.a in Frameworks */, 091BEAB3214552D9003AEA30 /* Vision.framework in Frameworks */, D0C45E9F213FFAFD00988156 /* Lottie.framework in Frameworks */, D00ACA4B20222C280045D427 /* libtgvoip.framework in Frameworks */, @@ -2384,10 +2395,12 @@ 09B4EE5721A82F5900847FA6 /* Permissions */ = { isa = PBXGroup; children = ( + 0962E67221B622BE00245FD9 /* PermissionSplitTest.swift */, 09B4EE4C21A7B73800847FA6 /* PermissionController.swift */, 09B4EE4E21A7B75D00847FA6 /* PermissionControllerNode.swift */, 09B4EE5D21AC626B00847FA6 /* PermissionContentNode.swift */, 09B4EE5121A7CC3E00847FA6 /* SolidRoundedButtonNode.swift */, + 0962E67621B673AF00245FD9 /* Permission.swift */, ); name = Permissions; sourceTree = ""; @@ -2480,9 +2493,13 @@ children = ( D0B844551DAC3AEE005F29E1 /* PresenceStrings.swift */, D05A32DB1E6EFCC2002760B4 /* NumericFormat.swift */, + D0C26D5D1FDF49E7004ABF18 /* DateFormat.swift */, D0BCC3D1203F0A6C008126C2 /* StringForMessageTimestampStatus.swift */, D017494D1E1059570057C89A /* StringWithAppliedEntities.swift */, 09C9EA3721A044B500E90146 /* StringForDuration.swift */, + D01D6BFB1E42AB3C006151C6 /* EmojiUtils.swift */, + D01BAA571ED3283D00295217 /* AddFormatToStringWithRanges.swift */, + D01C2AAC1E768404001F6F9A /* Markdown.swift */, ); name = Strings; sourceTree = ""; @@ -3278,6 +3295,7 @@ D08D45281D5E340200A7428A /* Frameworks */ = { isa = PBXGroup; children = ( + D045549921B2F173007A6DD9 /* libturbojpeg.a */, D0C45E9E213FFAFD00988156 /* Lottie.framework */, D02DADBE2138D76F00116225 /* Vision.framework */, D00ACA4C20222C280045D427 /* libtgvoip.framework */, @@ -4334,6 +4352,7 @@ D04B4D121EEA0A6500711AF6 /* ChatMessageMapBubbleContentNode.swift */, D0F69E281D6B8B030046BCD6 /* ChatMessageReplyInfoNode.swift */, D0F69E291D6B8B030046BCD6 /* ChatMessageStickerItemNode.swift */, + 0962E67821B67A9800245FD9 /* ChatMessageAnimatedStickerItemNode.swift */, D0575AF61EA0ED4F006F2541 /* ChatMessageInstantVideoItemNode.swift */, D0F69E2A1D6B8B030046BCD6 /* ChatMessageTextBubbleContentNode.swift */, D0ACCB1B1EC5FF4B0079D8BF /* ChatMessageCallBubbleContentNode.swift */, @@ -4550,12 +4569,9 @@ D0F917B41E0DA396003687E6 /* GenerateTextEntities.swift */, D01749541E1082770057C89A /* StoredMessageFromSearchPeer.swift */, D087750B1E3E7B7600A97350 /* PreferencesKeys.swift */, - D01D6BFB1E42AB3C006151C6 /* EmojiUtils.swift */, D0DA44551E4E7F43005FDCA7 /* ShakeAnimation.swift */, D0E305A41E5B2BFB00D7A3A2 /* ValidateAddressNameInteractive.swift */, - D01C2AAC1E768404001F6F9A /* Markdown.swift */, D0F3A8AA1E82D83E00B4C64C /* TelegramAccountAuxiliaryMethods.swift */, - D01BAA571ED3283D00295217 /* AddFormatToStringWithRanges.swift */, D0471B501EFD872F0074D609 /* CurrencyFormat.swift */, D079FCDC1F05C4F20038FADE /* LocalAuth.swift */, D079FCE81F06A76C0038FADE /* Notices.swift */, @@ -4564,7 +4580,6 @@ D0BDB09A1F79C658002ABF2F /* SaveToCameraRoll.swift */, D0208ADB1FA346A4001F0D5F /* RaiseToListen.swift */, D01C06BF1FBF118A001561AB /* MessageUtils.swift */, - D0C26D5D1FDF49E7004ABF18 /* DateFormat.swift */, D09250051FE5371D003F693F /* GlobalExperimentalSettings.swift */, D0C26D561FDF2388004ABF18 /* OpenChatMessage.swift */, D04ECD711FFBF22B00DE9029 /* OpenUrl.swift */, @@ -4641,6 +4656,7 @@ D0760B231E9D015D00F1F3C4 /* PasscodeOptionsController.swift */, D0CE6F6F213EEE5000BCD44B /* CreatePasswordController.swift */, D0B3AC7F2142E2E900CD1374 /* ResetPasswordController.swift */, + D04554A321B42982007A6DD9 /* ConfirmPhoneNumberController.swift */, D05D8B792195E00C0064586F /* Setup Two Step Verification */, ); name = "Privacy and Security"; @@ -5267,6 +5283,7 @@ D01BAA181ECC8E0000295217 /* CallListController.swift in Sources */, D0EC6D4B1EB9F58800EBF1C3 /* ChatListNode.swift in Sources */, D0EC6D4D1EB9F58800EBF1C3 /* ChatListHoleItem.swift in Sources */, + 0962E67921B67A9800245FD9 /* ChatMessageAnimatedStickerItemNode.swift in Sources */, D0EC6D4E1EB9F58800EBF1C3 /* ChatListItem.swift in Sources */, D0B2F76A2052920D00D3BFB9 /* UserInfoEditingPhoneItem.swift in Sources */, D0AEAE272080D6970013176E /* StickerPaneSearchBarNode.swift in Sources */, @@ -5384,6 +5401,7 @@ D0EC6D8A1EB9F58800EBF1C3 /* ChatInfo.swift in Sources */, D0EC6D8B1EB9F58800EBF1C3 /* ChatHistoryNavigationStack.swift in Sources */, D0EC6D8C1EB9F58800EBF1C3 /* NavigateToChatController.swift in Sources */, + 0962E67321B622BE00245FD9 /* PermissionSplitTest.swift in Sources */, D0EC6D8D1EB9F58800EBF1C3 /* ChatMessageActionItemNode.swift in Sources */, D0192D44210A5AA50005FA10 /* DeviceContactDataManager.swift in Sources */, D0EC6D8E1EB9F58800EBF1C3 /* ChatMessageAvatarAccessoryItem.swift in Sources */, @@ -5517,6 +5535,7 @@ 0962E66121B3512500245FD9 /* WebSearchController.swift in Sources */, D0EC6DC61EB9F58900EBF1C3 /* MultiplexedSoftwareVideoSourceManager.swift in Sources */, D0EC6DC71EB9F58900EBF1C3 /* SampleBufferPool.swift in Sources */, + 0962E67721B673AF00245FD9 /* Permission.swift in Sources */, D0EC6DC81EB9F58900EBF1C3 /* MultiplexedVideoNode.swift in Sources */, D0EC6DC91EB9F58900EBF1C3 /* SoftwareVideoLayerFrameManager.swift in Sources */, D0EC6DCA1EB9F58900EBF1C3 /* SoftwareVideoThumbnailLayer.swift in Sources */, @@ -5633,6 +5652,7 @@ D0EC6E071EB9F58900EBF1C3 /* ChatExternalFileGalleryItem.swift in Sources */, D0EC6E081EB9F58900EBF1C3 /* ChatImageGalleryItem.swift in Sources */, D048EA891F4F297500188713 /* InstantPageSettingsFontFamilyItemNode.swift in Sources */, + D04554A421B42982007A6DD9 /* ConfirmPhoneNumberController.swift in Sources */, D0EC6E0A1EB9F58900EBF1C3 /* ChatVideoGalleryItemScrubberView.swift in Sources */, D0EC6E0B1EB9F58900EBF1C3 /* ZoomableContentGalleryItemNode.swift in Sources */, D07ABBA5202A14BC003671DE /* LegacyImagePicker.swift in Sources */, @@ -5983,6 +6003,7 @@ "$(PROJECT_DIR)/third-party/opus/lib", "$(PROJECT_DIR)/third-party/libwebp/lib", "$(PROJECT_DIR)/third-party/FFmpeg-iOS/lib", + "$(PROJECT_DIR)/third-party/libjpeg-turbo", ); OTHER_CFLAGS = ( "-DTGVOIP_USE_CUSTOM_CRYPTO", @@ -6174,6 +6195,7 @@ "$(PROJECT_DIR)/third-party/opus/lib", "$(PROJECT_DIR)/third-party/libwebp/lib", "$(PROJECT_DIR)/third-party/FFmpeg-iOS/lib", + "$(PROJECT_DIR)/third-party/libjpeg-turbo", ); OTHER_CFLAGS = ( "-DTGVOIP_USE_CUSTOM_CRYPTO", @@ -6285,6 +6307,7 @@ "$(PROJECT_DIR)/third-party/opus/lib", "$(PROJECT_DIR)/third-party/libwebp/lib", "$(PROJECT_DIR)/third-party/FFmpeg-iOS/lib", + "$(PROJECT_DIR)/third-party/libjpeg-turbo", ); OTHER_CFLAGS = ( "-DTGVOIP_USE_CUSTOM_CRYPTO", @@ -6404,6 +6427,7 @@ "$(PROJECT_DIR)/third-party/opus/lib", "$(PROJECT_DIR)/third-party/libwebp/lib", "$(PROJECT_DIR)/third-party/FFmpeg-iOS/lib", + "$(PROJECT_DIR)/third-party/libjpeg-turbo", ); OTHER_CFLAGS = ( "-DTGVOIP_USE_CUSTOM_CRYPTO", @@ -6513,6 +6537,7 @@ "$(PROJECT_DIR)/third-party/opus/lib", "$(PROJECT_DIR)/third-party/libwebp/lib", "$(PROJECT_DIR)/third-party/FFmpeg-iOS/lib", + "$(PROJECT_DIR)/third-party/libjpeg-turbo", ); OTHER_CFLAGS = ( "-DTGVOIP_USE_CUSTOM_CRYPTO", @@ -6553,6 +6578,7 @@ "$(PROJECT_DIR)/third-party/opus/lib", "$(PROJECT_DIR)/third-party/libwebp/lib", "$(PROJECT_DIR)/third-party/FFmpeg-iOS/lib", + "$(PROJECT_DIR)/third-party/libjpeg-turbo", ); OTHER_CFLAGS = ( "-DTGVOIP_USE_CUSTOM_CRYPTO", @@ -6591,6 +6617,7 @@ "$(PROJECT_DIR)/third-party/opus/lib", "$(PROJECT_DIR)/third-party/libwebp/lib", "$(PROJECT_DIR)/third-party/FFmpeg-iOS/lib", + "$(PROJECT_DIR)/third-party/libjpeg-turbo", ); OTHER_CFLAGS = ( "-DTGVOIP_USE_CUSTOM_CRYPTO", @@ -6628,6 +6655,7 @@ "$(PROJECT_DIR)/third-party/opus/lib", "$(PROJECT_DIR)/third-party/libwebp/lib", "$(PROJECT_DIR)/third-party/FFmpeg-iOS/lib", + "$(PROJECT_DIR)/third-party/libjpeg-turbo", ); OTHER_CFLAGS = ( "-DTGVOIP_USE_CUSTOM_CRYPTO", diff --git a/TelegramUI/AuthorizationSequenceSignUpController.swift b/TelegramUI/AuthorizationSequenceSignUpController.swift index b9e5dd158b..55ff399240 100644 --- a/TelegramUI/AuthorizationSequenceSignUpController.swift +++ b/TelegramUI/AuthorizationSequenceSignUpController.swift @@ -68,7 +68,7 @@ final class AuthorizationSequenceSignUpController: ViewController { presentLegacyAvatarPicker(holder: currentAvatarMixin, signup: true, theme: defaultPresentationTheme, present: { c, a in self?.view.endEditing(true) self?.present(c, in: .window(.root), with: a) - }, completion: { image in + }, openCurrent: nil, completion: { image in self?.controllerNode.currentPhoto = image }) }) diff --git a/TelegramUI/AutodownloadSizeLimitItem.swift b/TelegramUI/AutodownloadSizeLimitItem.swift index 2fe66e3e45..874506d3d5 100644 --- a/TelegramUI/AutodownloadSizeLimitItem.swift +++ b/TelegramUI/AutodownloadSizeLimitItem.swift @@ -41,7 +41,7 @@ class AutodownloadSizeLimitItem: ListViewItem, ItemListItem { self.updated = updated } - func nodeConfiguredForParams(async: @escaping (@escaping () -> Void) -> Void, params: ListViewItemLayoutParams, synchronousLoads: Bool, previousItem: ListViewItem?, nextItem: ListViewItem?, completion: @escaping (ListViewItemNode, @escaping () -> (Signal?, () -> Void)) -> Void) { + func nodeConfiguredForParams(async: @escaping (@escaping () -> Void) -> Void, params: ListViewItemLayoutParams, synchronousLoads: Bool, previousItem: ListViewItem?, nextItem: ListViewItem?, completion: @escaping (ListViewItemNode, @escaping () -> (Signal?, (ListViewItemApply) -> Void)) -> Void) { async { let node = AutodownloadSizeLimitItemNode() let (layout, apply) = node.asyncLayout()(self, params, itemListNeighbors(item: self, topItem: previousItem as? ItemListItem, bottomItem: nextItem as? ItemListItem)) @@ -51,13 +51,13 @@ class AutodownloadSizeLimitItem: ListViewItem, ItemListItem { Queue.mainQueue().async { completion(node, { - return (nil, { apply() }) + return (nil, { _ in apply() }) }) } } } - func updateNode(async: @escaping (@escaping () -> Void) -> Void, node: @escaping () -> ListViewItemNode, params: ListViewItemLayoutParams, previousItem: ListViewItem?, nextItem: ListViewItem?, animation: ListViewItemUpdateAnimation, completion: @escaping (ListViewItemNodeLayout, @escaping () -> Void) -> Void) { + func updateNode(async: @escaping (@escaping () -> Void) -> Void, node: @escaping () -> ListViewItemNode, params: ListViewItemLayoutParams, previousItem: ListViewItem?, nextItem: ListViewItem?, animation: ListViewItemUpdateAnimation, completion: @escaping (ListViewItemNodeLayout, @escaping (ListViewItemApply) -> Void) -> Void) { Queue.mainQueue().async { if let nodeValue = node() as? AutodownloadSizeLimitItemNode { let makeLayout = nodeValue.asyncLayout() @@ -65,7 +65,7 @@ class AutodownloadSizeLimitItem: ListViewItem, ItemListItem { async { let (layout, apply) = makeLayout(self, params, itemListNeighbors(item: self, topItem: previousItem as? ItemListItem, bottomItem: nextItem as? ItemListItem)) Queue.mainQueue().async { - completion(layout, { + completion(layout, { _ in apply() }) } diff --git a/TelegramUI/AvatarGalleryController.swift b/TelegramUI/AvatarGalleryController.swift index 083e019949..4e1c8c06be 100644 --- a/TelegramUI/AvatarGalleryController.swift +++ b/TelegramUI/AvatarGalleryController.swift @@ -6,16 +6,26 @@ import SwiftSignalKit import AsyncDisplayKit import TelegramCore -enum AvatarGalleryEntry: Equatable { - case topImage([TelegramMediaImageRepresentation], GalleryItemIndexData?) - case image(TelegramMediaImage, Peer, Int32, GalleryItemIndexData?) +public struct ImageRepresentationWithReference: Equatable { + public let representation: TelegramMediaImageRepresentation + public let reference: MediaResourceReference - var representations: [TelegramMediaImageRepresentation] { + public init(representation: TelegramMediaImageRepresentation, reference: MediaResourceReference) { + self.representation = representation + self.reference = reference + } +} + +enum AvatarGalleryEntry: Equatable { + case topImage([ImageRepresentationWithReference], GalleryItemIndexData?) + case image(TelegramMediaImageReference?, [ImageRepresentationWithReference], Peer, Int32, GalleryItemIndexData?) + + var representations: [ImageRepresentationWithReference] { switch self { case let .topImage(representations, _): return representations - case let .image(image, _, _, _): - return image.representations + case let .image(_, representations, _, _, _): + return representations } } @@ -23,7 +33,7 @@ enum AvatarGalleryEntry: Equatable { switch self { case let .topImage(_, indexData): return indexData - case let .image(_, _, _, indexData): + case let .image(_, _, _, _, indexData): return indexData } } @@ -36,8 +46,8 @@ enum AvatarGalleryEntry: Equatable { } else { return false } - case let .image(lhsImage, lhsPeer, lhsDate, lhsIndexData): - if case let .image(rhsImage, rhsPeer, rhsDate, rhsIndexData) = rhs, lhsImage.isEqual(to: rhsImage), arePeersEqual(lhsPeer, rhsPeer), lhsDate == rhsDate, lhsIndexData == rhsIndexData { + case let .image(lhsImageReference, lhsRepresentations, lhsPeer, lhsDate, lhsIndexData): + if case let .image(rhsImageReference, rhsRepresentations, rhsPeer, rhsDate, rhsIndexData) = rhs, lhsImageReference == rhsImageReference, lhsRepresentations == rhsRepresentations, arePeersEqual(lhsPeer, rhsPeer), lhsDate == rhsDate, lhsIndexData == rhsIndexData { return true } else { return false @@ -58,12 +68,8 @@ final class AvatarGalleryControllerPresentationArguments { private func initialAvatarGalleryEntries(peer: Peer) -> [AvatarGalleryEntry]{ var initialEntries: [AvatarGalleryEntry] = [] - if let user = peer as? TelegramUser, !user.photo.isEmpty { - initialEntries.append(.topImage(user.photo, nil)) - } else if let group = peer as? TelegramGroup { - initialEntries.append(.topImage(group.photo, nil)) - } else if let channel = peer as? TelegramChannel { - initialEntries.append(.topImage(channel.photo, nil)) + if !peer.profileImageRepresentations.isEmpty, let peerReference = PeerReference(peer) { + initialEntries.append(.topImage(peer.profileImageRepresentations.map({ ImageRepresentationWithReference(representation: $0, reference: MediaResourceReference.avatar(peer: peerReference, resource: $0.resource)) }), nil)) } return initialEntries } @@ -79,10 +85,9 @@ func fetchedAvatarGalleryEntries(account: Account, peer: Peer) -> Signal<[Avatar for photo in photos { let indexData = GalleryItemIndexData(position: index, totalCount: Int32(photos.count)) if result.isEmpty, let first = initialEntries.first { - let image = TelegramMediaImage(imageId: photo.image.imageId, representations: first.representations, reference: photo.reference, partialReference: nil) - result.append(.image(image, peer, photo.date, indexData)) + result.append(.image(photo.image.reference, first.representations, peer, photo.date, indexData)) } else { - result.append(.image(photo.image, peer, photo.date, indexData)) + result.append(.image(photo.image.reference, photo.image.representations.map({ ImageRepresentationWithReference(representation: $0, reference: MediaResourceReference.standalone(resource: $0.resource)) }), peer, photo.date, indexData)) } index += 1 } @@ -387,8 +392,8 @@ class AvatarGalleryController: ViewController { switch entry { case .topImage: break - case let .image(image, _, _, _): - if let reference = image.reference { + case let .image(reference, _, _, _, _): + if let reference = reference { let _ = removeAccountPhoto(network: self.account.network, reference: reference).start() } if entry == self.entries.first { diff --git a/TelegramUI/AvatarGalleryItemFooterContentNode.swift b/TelegramUI/AvatarGalleryItemFooterContentNode.swift index 6d83c6f3fe..b3d64b1e84 100644 --- a/TelegramUI/AvatarGalleryItemFooterContentNode.swift +++ b/TelegramUI/AvatarGalleryItemFooterContentNode.swift @@ -74,7 +74,7 @@ final class AvatarGalleryItemFooterContentNode: GalleryFooterContentNode { var nameText: String? var dateText: String? switch entry { - case let .image(_, peer, date, _): + case let .image(_, _, peer, date, _): nameText = peer.displayTitle dateText = humanReadableStringForTimestamp(strings: self.strings, dateTimeFormat: self.dateTimeFormat, timestamp: date) default: diff --git a/TelegramUI/BotCheckoutHeaderItem.swift b/TelegramUI/BotCheckoutHeaderItem.swift index 08f6270969..45690225ca 100644 --- a/TelegramUI/BotCheckoutHeaderItem.swift +++ b/TelegramUI/BotCheckoutHeaderItem.swift @@ -19,7 +19,7 @@ class BotCheckoutHeaderItem: ListViewItem, ItemListItem { self.sectionId = sectionId } - func nodeConfiguredForParams(async: @escaping (@escaping () -> Void) -> Void, params: ListViewItemLayoutParams, synchronousLoads: Bool, previousItem: ListViewItem?, nextItem: ListViewItem?, completion: @escaping (ListViewItemNode, @escaping () -> (Signal?, () -> Void)) -> Void) { + func nodeConfiguredForParams(async: @escaping (@escaping () -> Void) -> Void, params: ListViewItemLayoutParams, synchronousLoads: Bool, previousItem: ListViewItem?, nextItem: ListViewItem?, completion: @escaping (ListViewItemNode, @escaping () -> (Signal?, (ListViewItemApply) -> Void)) -> Void) { async { let node = BotCheckoutHeaderItemNode() let (layout, apply) = node.asyncLayout()(self, params, itemListNeighbors(item: self, topItem: previousItem as? ItemListItem, bottomItem: nextItem as? ItemListItem)) @@ -29,13 +29,13 @@ class BotCheckoutHeaderItem: ListViewItem, ItemListItem { Queue.mainQueue().async { completion(node, { - return (nil, { apply() }) + return (nil, { _ in apply() }) }) } } } - func updateNode(async: @escaping (@escaping () -> Void) -> Void, node: @escaping () -> ListViewItemNode, params: ListViewItemLayoutParams, previousItem: ListViewItem?, nextItem: ListViewItem?, animation: ListViewItemUpdateAnimation, completion: @escaping (ListViewItemNodeLayout, @escaping () -> Void) -> Void) { + func updateNode(async: @escaping (@escaping () -> Void) -> Void, node: @escaping () -> ListViewItemNode, params: ListViewItemLayoutParams, previousItem: ListViewItem?, nextItem: ListViewItem?, animation: ListViewItemUpdateAnimation, completion: @escaping (ListViewItemNodeLayout, @escaping (ListViewItemApply) -> Void) -> Void) { Queue.mainQueue().async { if let nodeValue = node() as? BotCheckoutHeaderItemNode { let makeLayout = nodeValue.asyncLayout() @@ -43,7 +43,7 @@ class BotCheckoutHeaderItem: ListViewItem, ItemListItem { async { let (layout, apply) = makeLayout(self, params, itemListNeighbors(item: self, topItem: previousItem as? ItemListItem, bottomItem: nextItem as? ItemListItem)) Queue.mainQueue().async { - completion(layout, { + completion(layout, { _ in apply() }) } diff --git a/TelegramUI/BotCheckoutPriceItem.swift b/TelegramUI/BotCheckoutPriceItem.swift index 476ee6411f..a720997e07 100644 --- a/TelegramUI/BotCheckoutPriceItem.swift +++ b/TelegramUI/BotCheckoutPriceItem.swift @@ -20,7 +20,7 @@ class BotCheckoutPriceItem: ListViewItem, ItemListItem { self.sectionId = sectionId } - func nodeConfiguredForParams(async: @escaping (@escaping () -> Void) -> Void, params: ListViewItemLayoutParams, synchronousLoads: Bool, previousItem: ListViewItem?, nextItem: ListViewItem?, completion: @escaping (ListViewItemNode, @escaping () -> (Signal?, () -> Void)) -> Void) { + func nodeConfiguredForParams(async: @escaping (@escaping () -> Void) -> Void, params: ListViewItemLayoutParams, synchronousLoads: Bool, previousItem: ListViewItem?, nextItem: ListViewItem?, completion: @escaping (ListViewItemNode, @escaping () -> (Signal?, (ListViewItemApply) -> Void)) -> Void) { async { let node = BotCheckoutPriceItemNode() let (layout, apply) = node.asyncLayout()(self, params, itemListNeighbors(item: self, topItem: previousItem as? ItemListItem, bottomItem: nextItem as? ItemListItem)) @@ -30,13 +30,13 @@ class BotCheckoutPriceItem: ListViewItem, ItemListItem { Queue.mainQueue().async { completion(node, { - return (nil, { apply() }) + return (nil, { _ in apply() }) }) } } } - func updateNode(async: @escaping (@escaping () -> Void) -> Void, node: @escaping () -> ListViewItemNode, params: ListViewItemLayoutParams, previousItem: ListViewItem?, nextItem: ListViewItem?, animation: ListViewItemUpdateAnimation, completion: @escaping (ListViewItemNodeLayout, @escaping () -> Void) -> Void) { + func updateNode(async: @escaping (@escaping () -> Void) -> Void, node: @escaping () -> ListViewItemNode, params: ListViewItemLayoutParams, previousItem: ListViewItem?, nextItem: ListViewItem?, animation: ListViewItemUpdateAnimation, completion: @escaping (ListViewItemNodeLayout, @escaping (ListViewItemApply) -> Void) -> Void) { Queue.mainQueue().async { if let nodeValue = node() as? BotCheckoutPriceItemNode { let makeLayout = nodeValue.asyncLayout() @@ -44,7 +44,7 @@ class BotCheckoutPriceItem: ListViewItem, ItemListItem { async { let (layout, apply) = makeLayout(self, params, itemListNeighbors(item: self, topItem: previousItem as? ItemListItem, bottomItem: nextItem as? ItemListItem)) Queue.mainQueue().async { - completion(layout, { + completion(layout, { _ in apply() }) } diff --git a/TelegramUI/CalculatingCacheSizeItem.swift b/TelegramUI/CalculatingCacheSizeItem.swift index bd9cbdf892..750dc2cb33 100644 --- a/TelegramUI/CalculatingCacheSizeItem.swift +++ b/TelegramUI/CalculatingCacheSizeItem.swift @@ -16,7 +16,7 @@ class CalculatingCacheSizeItem: ListViewItem, ItemListItem { self.style = style } - func nodeConfiguredForParams(async: @escaping (@escaping () -> Void) -> Void, params: ListViewItemLayoutParams, synchronousLoads: Bool, previousItem: ListViewItem?, nextItem: ListViewItem?, completion: @escaping (ListViewItemNode, @escaping () -> (Signal?, () -> Void)) -> Void) { + func nodeConfiguredForParams(async: @escaping (@escaping () -> Void) -> Void, params: ListViewItemLayoutParams, synchronousLoads: Bool, previousItem: ListViewItem?, nextItem: ListViewItem?, completion: @escaping (ListViewItemNode, @escaping () -> (Signal?, (ListViewItemApply) -> Void)) -> Void) { async { let node = CalculatingCacheSizeItemNode() let (layout, apply) = node.asyncLayout()(self, params, itemListNeighbors(item: self, topItem: previousItem as? ItemListItem, bottomItem: nextItem as? ItemListItem)) @@ -26,13 +26,13 @@ class CalculatingCacheSizeItem: ListViewItem, ItemListItem { Queue.mainQueue().async { completion(node, { - return (nil, { apply() }) + return (nil, { _ in apply() }) }) } } } - func updateNode(async: @escaping (@escaping () -> Void) -> Void, node: @escaping () -> ListViewItemNode, params: ListViewItemLayoutParams, previousItem: ListViewItem?, nextItem: ListViewItem?, animation: ListViewItemUpdateAnimation, completion: @escaping (ListViewItemNodeLayout, @escaping () -> Void) -> Void) { + func updateNode(async: @escaping (@escaping () -> Void) -> Void, node: @escaping () -> ListViewItemNode, params: ListViewItemLayoutParams, previousItem: ListViewItem?, nextItem: ListViewItem?, animation: ListViewItemUpdateAnimation, completion: @escaping (ListViewItemNodeLayout, @escaping (ListViewItemApply) -> Void) -> Void) { Queue.mainQueue().async { if let nodeValue = node() as? CalculatingCacheSizeItemNode { let makeLayout = nodeValue.asyncLayout() @@ -40,7 +40,7 @@ class CalculatingCacheSizeItem: ListViewItem, ItemListItem { async { let (layout, apply) = makeLayout(self, params, itemListNeighbors(item: self, topItem: previousItem as? ItemListItem, bottomItem: nextItem as? ItemListItem)) Queue.mainQueue().async { - completion(layout, { + completion(layout, { _ in apply() }) } diff --git a/TelegramUI/CallController.swift b/TelegramUI/CallController.swift index a274dd6aec..4c0e2f067d 100644 --- a/TelegramUI/CallController.swift +++ b/TelegramUI/CallController.swift @@ -168,15 +168,15 @@ public final class CallController: ViewController { } self.peerDisposable = (account.postbox.peerView(id: self.call.peerId) - |> deliverOnMainQueue).start(next: { [weak self] view in - if let strongSelf = self { - if let peer = view.peers[view.peerId] { - strongSelf.peer = peer - strongSelf.controllerNode.updatePeer(peer: peer) - strongSelf._ready.set(.single(true)) - } + |> deliverOnMainQueue).start(next: { [weak self] view in + if let strongSelf = self { + if let peer = view.peers[view.peerId] { + strongSelf.peer = peer + strongSelf.controllerNode.updatePeer(peer: peer) + strongSelf._ready.set(.single(true)) } - }) + } + }) self.controllerNode.isMuted = self.isMuted diff --git a/TelegramUI/CallControllerNode.swift b/TelegramUI/CallControllerNode.swift index 7ebc94d6f4..e56f6b1b66 100644 --- a/TelegramUI/CallControllerNode.swift +++ b/TelegramUI/CallControllerNode.swift @@ -151,7 +151,7 @@ final class CallControllerNode: ASDisplayNode { if !arePeersEqual(self.peer, peer) { self.peer = peer if let peerReference = PeerReference(peer), !peer.profileImageRepresentations.isEmpty { - let representations: [(TelegramMediaImageRepresentation, MediaResourceReference)] = peer.profileImageRepresentations.map({ ($0, .avatar(peer: peerReference, resource: $0.resource)) }) + let representations: [ImageRepresentationWithReference] = peer.profileImageRepresentations.map({ ImageRepresentationWithReference(representation: $0, reference: .avatar(peer: peerReference, resource: $0.resource)) }) self.imageNode.setSignal(chatAvatarGalleryPhoto(account: self.account, representations: representations, autoFetchFullSize: true)) self.dimNode.isHidden = false } else { diff --git a/TelegramUI/CallKitIntergation.swift b/TelegramUI/CallKitIntergation.swift index d16df31bb8..d11abfb86f 100644 --- a/TelegramUI/CallKitIntergation.swift +++ b/TelegramUI/CallKitIntergation.swift @@ -4,9 +4,9 @@ import AVFoundation import Postbox import SwiftSignalKit +private var sharedProviderDelegate: AnyObject? + public final class CallKitIntegration { - private let providerDelegate: AnyObject - public static var isAvailable: Bool { #if targetEnvironment(simulator) return false @@ -34,7 +34,10 @@ public final class CallKitIntegration { #else if #available(iOSApplicationExtension 10.0, *) { - self.providerDelegate = CallKitProviderDelegate(audioSessionActivePromise: self.audioSessionActivePromise, startCall: startCall, answerCall: answerCall, endCall: endCall, setCallMuted: setCallMuted, audioSessionActivationChanged: audioSessionActivationChanged) + if sharedProviderDelegate == nil { + sharedProviderDelegate = CallKitProviderDelegate() + } + (sharedProviderDelegate as? CallKitProviderDelegate)?.setup(audioSessionActivePromise: self.audioSessionActivePromise, startCall: startCall, answerCall: answerCall, endCall: endCall, setCallMuted: setCallMuted, audioSessionActivationChanged: audioSessionActivationChanged) } else { return nil } @@ -43,31 +46,31 @@ public final class CallKitIntegration { func startCall(peerId: PeerId, displayTitle: String) { if #available(iOSApplicationExtension 10.0, *) { - (self.providerDelegate as! CallKitProviderDelegate).startCall(peerId: peerId, displayTitle: displayTitle) + (sharedProviderDelegate as? CallKitProviderDelegate)?.startCall(peerId: peerId, displayTitle: displayTitle) } } func answerCall(uuid: UUID) { if #available(iOSApplicationExtension 10.0, *) { - (self.providerDelegate as! CallKitProviderDelegate).answerCall(uuid: uuid) + (sharedProviderDelegate as? CallKitProviderDelegate)?.answerCall(uuid: uuid) } } func dropCall(uuid: UUID) { if #available(iOSApplicationExtension 10.0, *) { - (self.providerDelegate as! CallKitProviderDelegate).dropCall(uuid: uuid) + (sharedProviderDelegate as? CallKitProviderDelegate)?.dropCall(uuid: uuid) } } func reportIncomingCall(uuid: UUID, handle: String, displayTitle: String, completion: ((NSError?) -> Void)?) { if #available(iOSApplicationExtension 10.0, *) { - (self.providerDelegate as! CallKitProviderDelegate).reportIncomingCall(uuid: uuid, handle: handle, displayTitle: displayTitle, completion: completion) + (sharedProviderDelegate as? CallKitProviderDelegate)?.reportIncomingCall(uuid: uuid, handle: handle, displayTitle: displayTitle, completion: completion) } } func reportOutgoingCallConnected(uuid: UUID, at date: Date) { if #available(iOSApplicationExtension 10.0, *) { - (self.providerDelegate as! CallKitProviderDelegate).reportOutgoingCallConnected(uuid: uuid, at: date) + (sharedProviderDelegate as? CallKitProviderDelegate)?.reportOutgoingCallConnected(uuid: uuid, at: date) } } } @@ -77,29 +80,31 @@ class CallKitProviderDelegate: NSObject, CXProviderDelegate { private let provider: CXProvider private let callController = CXCallController() - private let startCall: (UUID, String) -> Signal - private let answerCall: (UUID) -> Void - private let endCall: (UUID) -> Signal - private let setCallMuted: (UUID, Bool) -> Void - private let audioSessionActivationChanged: (Bool) -> Void + private var startCall: ((UUID, String) -> Signal)? + private var answerCall: ((UUID) -> Void)? + private var endCall: ((UUID) -> Signal)? + private var setCallMuted: ((UUID, Bool) -> Void)? + private var audioSessionActivationChanged: ((Bool) -> Void)? private let disposableSet = DisposableSet() - fileprivate let audioSessionActivePromise: ValuePromise + fileprivate var audioSessionActivePromise: ValuePromise? - init(audioSessionActivePromise: ValuePromise, startCall: @escaping (UUID, String) -> Signal, answerCall: @escaping (UUID) -> Void, endCall: @escaping (UUID) -> Signal, setCallMuted: @escaping (UUID, Bool) -> Void, audioSessionActivationChanged: @escaping (Bool) -> Void) { + override init() { + self.provider = CXProvider(configuration: CallKitProviderDelegate.providerConfiguration) + + super.init() + + self.provider.setDelegate(self, queue: nil) + } + + func setup(audioSessionActivePromise: ValuePromise, startCall: @escaping (UUID, String) -> Signal, answerCall: @escaping (UUID) -> Void, endCall: @escaping (UUID) -> Signal, setCallMuted: @escaping (UUID, Bool) -> Void, audioSessionActivationChanged: @escaping (Bool) -> Void) { self.audioSessionActivePromise = audioSessionActivePromise self.startCall = startCall self.answerCall = answerCall self.endCall = endCall self.setCallMuted = setCallMuted self.audioSessionActivationChanged = audioSessionActivationChanged - - self.provider = CXProvider(configuration: CallKitProviderDelegate.providerConfiguration) - - super.init() - - self.provider.setDelegate(self, queue: nil) } static var providerConfiguration: CXProviderConfiguration { @@ -184,19 +189,16 @@ class CallKitProviderDelegate: NSObject, CXProviderDelegate { } func providerDidReset(_ provider: CXProvider) { - /*stopAudio() - - for call in callManager.calls { - call.end() - } - - callManager.removeAllCalls()*/ } func provider(_ provider: CXProvider, perform action: CXStartCallAction) { + guard let startCall = self.startCall else { + action.fail() + return + } let disposable = MetaDisposable() self.disposableSet.add(disposable) - disposable.set((self.startCall(action.callUUID, action.handle.value) + disposable.set((startCall(action.callUUID, action.handle.value) |> deliverOnMainQueue |> afterDisposed { [weak self, weak disposable] in if let strongSelf = self, let disposable = disposable { @@ -212,42 +214,53 @@ class CallKitProviderDelegate: NSObject, CXProviderDelegate { } func provider(_ provider: CXProvider, perform action: CXAnswerCallAction) { - self.answerCall(action.callUUID) - + guard let answerCall = self.answerCall else { + action.fail() + return + } + answerCall(action.callUUID) action.fulfill() } func provider(_ provider: CXProvider, perform action: CXEndCallAction) { + guard let endCall = self.endCall else { + action.fail() + return + } let disposable = MetaDisposable() self.disposableSet.add(disposable) - disposable.set((self.endCall(action.callUUID) - |> deliverOnMainQueue - |> afterDisposed { [weak self, weak disposable] in - if let strongSelf = self, let disposable = disposable { - strongSelf.disposableSet.remove(disposable) - } - }).start(next: { result in - if result { - action.fulfill(withDateEnded: Date()) - } else { - action.fail() - } - })) + disposable.set((endCall(action.callUUID) + |> deliverOnMainQueue + |> afterDisposed { [weak self, weak disposable] in + if let strongSelf = self, let disposable = disposable { + strongSelf.disposableSet.remove(disposable) + } + }).start(next: { result in + if result { + action.fulfill(withDateEnded: Date()) + } else { + action.fail() + } + })) } func provider(_ provider: CXProvider, perform action: CXSetMutedCallAction) { - self.setCallMuted(action.uuid, action.isMuted) + guard let setCallMuted = self.setCallMuted else { + action.fail() + return + } + setCallMuted(action.uuid, action.isMuted) action.fulfill() } func provider(_ provider: CXProvider, didActivate audioSession: AVAudioSession) { - self.audioSessionActivationChanged(true) - self.audioSessionActivePromise.set(true) + self.audioSessionActivationChanged?(true) + self.audioSessionActivePromise?.set(true) } func provider(_ provider: CXProvider, didDeactivate audioSession: AVAudioSession) { - self.audioSessionActivationChanged(false) - self.audioSessionActivePromise.set(false) + self.audioSessionActivationChanged?(false) + self.audioSessionActivePromise?.set(false) } } diff --git a/TelegramUI/CallListCallItem.swift b/TelegramUI/CallListCallItem.swift index 126ee2467d..e513c49855 100644 --- a/TelegramUI/CallListCallItem.swift +++ b/TelegramUI/CallListCallItem.swift @@ -92,7 +92,7 @@ class CallListCallItem: ListViewItem { self.header = nil } - func nodeConfiguredForParams(async: @escaping (@escaping () -> Void) -> Void, params: ListViewItemLayoutParams, synchronousLoads: Bool, previousItem: ListViewItem?, nextItem: ListViewItem?, completion: @escaping (ListViewItemNode, @escaping () -> (Signal?, () -> Void)) -> Void) { + func nodeConfiguredForParams(async: @escaping (@escaping () -> Void) -> Void, params: ListViewItemLayoutParams, synchronousLoads: Bool, previousItem: ListViewItem?, nextItem: ListViewItem?, completion: @escaping (ListViewItemNode, @escaping () -> (Signal?, (ListViewItemApply) -> Void)) -> Void) { async { let node = CallListCallItemNode() let makeLayout = node.asyncLayout() @@ -103,7 +103,7 @@ class CallListCallItem: ListViewItem { Queue.mainQueue().async { completion(node, { - return (nil, { + return (nil, { _ in nodeApply().1(false) }) }) @@ -111,7 +111,7 @@ class CallListCallItem: ListViewItem { } } - func updateNode(async: @escaping (@escaping () -> Void) -> Void, node: @escaping () -> ListViewItemNode, params: ListViewItemLayoutParams, previousItem: ListViewItem?, nextItem: ListViewItem?, animation: ListViewItemUpdateAnimation, completion: @escaping (ListViewItemNodeLayout, @escaping () -> Void) -> Void) { + func updateNode(async: @escaping (@escaping () -> Void) -> Void, node: @escaping () -> ListViewItemNode, params: ListViewItemLayoutParams, previousItem: ListViewItem?, nextItem: ListViewItem?, animation: ListViewItemUpdateAnimation, completion: @escaping (ListViewItemNodeLayout, @escaping (ListViewItemApply) -> Void) -> Void) { Queue.mainQueue().async { if let nodeValue = node() as? CallListCallItemNode { let layout = nodeValue.asyncLayout() @@ -123,7 +123,7 @@ class CallListCallItem: ListViewItem { animated = false } Queue.mainQueue().async { - completion(nodeLayout, { + completion(nodeLayout, { _ in apply().1(animated) }) } diff --git a/TelegramUI/ChangePhoneNumberCodeController.swift b/TelegramUI/ChangePhoneNumberCodeController.swift index 0d67bf9c16..3af34a4b30 100644 --- a/TelegramUI/ChangePhoneNumberCodeController.swift +++ b/TelegramUI/ChangePhoneNumberCodeController.swift @@ -38,7 +38,7 @@ private enum ChangePhoneNumberCodeTag: ItemListItemTag { } private enum ChangePhoneNumberCodeEntry: ItemListNodeEntry { - case codeEntry(PresentationTheme, String) + case codeEntry(PresentationTheme, String, String) case codeInfo(PresentationTheme, String) var section: ItemListSectionId { @@ -56,8 +56,8 @@ private enum ChangePhoneNumberCodeEntry: ItemListNodeEntry { static func ==(lhs: ChangePhoneNumberCodeEntry, rhs: ChangePhoneNumberCodeEntry) -> Bool { switch lhs { - case let .codeEntry(lhsTheme, lhsText): - if case let .codeEntry(rhsTheme, rhsText) = rhs, lhsTheme === rhsTheme, lhsText == rhsText { + case let .codeEntry(lhsTheme, lhsTitle, lhsText): + if case let .codeEntry(rhsTheme, rhsTitle, rhsText) = rhs, lhsTheme === rhsTheme, lhsTitle == rhsTitle, lhsText == rhsText { return true } else { return false @@ -77,8 +77,8 @@ private enum ChangePhoneNumberCodeEntry: ItemListNodeEntry { func item(_ arguments: ChangePhoneNumberCodeControllerArguments) -> ListViewItem { switch self { - case let .codeEntry(theme, text): - return ItemListSingleLineInputItem(theme: theme, title: NSAttributedString(string: "Code", textColor: .black), text: text, placeholder: "", type: .number, spacing: 10.0, tag: ChangePhoneNumberCodeTag.input, sectionId: self.section, textUpdated: { updatedText in + case let .codeEntry(theme, title, text): + return ItemListSingleLineInputItem(theme: theme, title: NSAttributedString(string: title, textColor: .black), text: text, placeholder: "", type: .number, spacing: 10.0, tag: ChangePhoneNumberCodeTag.input, sectionId: self.section, textUpdated: { updatedText in arguments.updateEntryText(updatedText) }, action: { arguments.next() @@ -129,7 +129,7 @@ private struct ChangePhoneNumberCodeControllerState: Equatable { private func changePhoneNumberCodeControllerEntries(presentationData: PresentationData, state: ChangePhoneNumberCodeControllerState, codeData: ChangeAccountPhoneNumberData, timeout: Int32?, strings: PresentationStrings, theme: AuthorizationTheme) -> [ChangePhoneNumberCodeEntry] { var entries: [ChangePhoneNumberCodeEntry] = [] - entries.append(.codeEntry(presentationData.theme, state.codeText)) + entries.append(.codeEntry(presentationData.theme, presentationData.strings.ChangePhoneNumberCode_CodePlaceholder, state.codeText)) var text = authorizationCurrentOptionText(codeData.type, strings: presentationData.strings, primaryColor: presentationData.theme.list.itemPrimaryTextColor, accentColor: presentationData.theme.list.itemAccentColor).string if let nextType = codeData.nextType { text += "\n\n" + authorizationNextOptionText(currentType: codeData.type, nextType: nextType, timeout: timeout, strings: presentationData.strings, primaryColor: .black, accentColor: .black).0.string @@ -194,7 +194,7 @@ func changePhoneNumberCodeController(account: Account, phoneNumber: String, code } var dismissImpl: (() -> Void)? - var presentControllerImpl: ((ViewController, ViewControllerPresentationArguments) -> Void)? + var presentControllerImpl: ((ViewController, Any?) -> Void)? let actionsDisposable = DisposableSet() @@ -264,7 +264,7 @@ func changePhoneNumberCodeController(account: Account, phoneNumber: String, code return $0.withUpdatedChecking(false) } let presentationData = account.telegramApplicationContext.currentPresentationData.with { $0 } - presentControllerImpl?(standardTextAlertController(theme: AlertControllerTheme(presentationTheme: presentationData.theme), title: nil, text: "You have changed your phone number to \(formatPhoneNumber(phoneNumber)).", actions: [TextAlertAction(type: .defaultAction, title: presentationData.strings.Common_OK, action: {})]), ViewControllerPresentationArguments(presentationAnimation: .modalSheet)) + presentControllerImpl?(OverlayStatusController(theme: presentationData.theme, strings: presentationData.strings, type: .success), nil) dismissImpl?() })) } diff --git a/TelegramUI/ChannelInfoController.swift b/TelegramUI/ChannelInfoController.swift index ff5fa4a65d..94a56f80a8 100644 --- a/TelegramUI/ChannelInfoController.swift +++ b/TelegramUI/ChannelInfoController.swift @@ -620,7 +620,7 @@ public func channelInfoController(account: Account, peerId: PeerId) -> ViewContr }) hiddenAvatarRepresentationDisposable.set((galleryController.hiddenMedia |> deliverOnMainQueue).start(next: { entry in - avatarAndNameInfoContext.hiddenAvatarRepresentation = entry?.representations.first + avatarAndNameInfoContext.hiddenAvatarRepresentation = entry?.representations.first?.representation updateHiddenAvatarImpl?() })) presentControllerImpl?(galleryController, AvatarGalleryControllerPresentationArguments(transitionArguments: { entry in diff --git a/TelegramUI/ChatBotInfoItem.swift b/TelegramUI/ChatBotInfoItem.swift index 6bf0eb7f1b..9fb2dc3b34 100644 --- a/TelegramUI/ChatBotInfoItem.swift +++ b/TelegramUI/ChatBotInfoItem.swift @@ -21,7 +21,7 @@ final class ChatBotInfoItem: ListViewItem { self.presentationData = presentationData } - func nodeConfiguredForParams(async: @escaping (@escaping () -> Void) -> Void, params: ListViewItemLayoutParams, synchronousLoads: Bool, previousItem: ListViewItem?, nextItem: ListViewItem?, completion: @escaping (ListViewItemNode, @escaping () -> (Signal?, () -> Void)) -> Void) { + func nodeConfiguredForParams(async: @escaping (@escaping () -> Void) -> Void, params: ListViewItemLayoutParams, synchronousLoads: Bool, previousItem: ListViewItem?, nextItem: ListViewItem?, completion: @escaping (ListViewItemNode, @escaping () -> (Signal?, (ListViewItemApply) -> Void)) -> Void) { let configure = { let node = ChatBotInfoItemNode() @@ -33,7 +33,7 @@ final class ChatBotInfoItem: ListViewItem { Queue.mainQueue().async { completion(node, { - return (nil, { apply(.None) }) + return (nil, { _ in apply(.None) }) }) } } @@ -46,7 +46,7 @@ final class ChatBotInfoItem: ListViewItem { } } - func updateNode(async: @escaping (@escaping () -> Void) -> Void, node: @escaping () -> ListViewItemNode, params: ListViewItemLayoutParams, previousItem: ListViewItem?, nextItem: ListViewItem?, animation: ListViewItemUpdateAnimation, completion: @escaping (ListViewItemNodeLayout, @escaping () -> Void) -> Void) { + func updateNode(async: @escaping (@escaping () -> Void) -> Void, node: @escaping () -> ListViewItemNode, params: ListViewItemLayoutParams, previousItem: ListViewItem?, nextItem: ListViewItem?, animation: ListViewItemUpdateAnimation, completion: @escaping (ListViewItemNodeLayout, @escaping (ListViewItemApply) -> Void) -> Void) { Queue.mainQueue().async { if let nodeValue = node() as? ChatBotInfoItemNode { let nodeLayout = nodeValue.asyncLayout() @@ -54,7 +54,7 @@ final class ChatBotInfoItem: ListViewItem { async { let (layout, apply) = nodeLayout(self, params) Queue.mainQueue().async { - completion(layout, { + completion(layout, { _ in apply(animation) }) } diff --git a/TelegramUI/ChatButtonKeyboardInputNode.swift b/TelegramUI/ChatButtonKeyboardInputNode.swift index 4a2714fb60..f35e83c748 100644 --- a/TelegramUI/ChatButtonKeyboardInputNode.swift +++ b/TelegramUI/ChatButtonKeyboardInputNode.swift @@ -66,7 +66,7 @@ final class ChatButtonKeyboardInputNode: ChatInputNode { } } - override func updateLayout(width: CGFloat, leftInset: CGFloat, rightInset: CGFloat, bottomInset: CGFloat, standardInputHeight: CGFloat, inputHeight: CGFloat, maximumHeight: CGFloat, inputPanelHeight: CGFloat, transition: ContainedViewLayoutTransition, interfaceState: ChatPresentationInterfaceState) -> (CGFloat, CGFloat) { + override func updateLayout(width: CGFloat, leftInset: CGFloat, rightInset: CGFloat, bottomInset: CGFloat, standardInputHeight: CGFloat, inputHeight: CGFloat, maximumHeight: CGFloat, inputPanelHeight: CGFloat, transition: ContainedViewLayoutTransition, interfaceState: ChatPresentationInterfaceState, isVisible: Bool) -> (CGFloat, CGFloat) { transition.updateFrame(node: self.separatorNode, frame: CGRect(origin: CGPoint(), size: CGSize(width: width, height: UIScreenPixel))) if self.theme !== interfaceState.theme { diff --git a/TelegramUI/ChatController.swift b/TelegramUI/ChatController.swift index 8bd7528e94..25a2dec993 100644 --- a/TelegramUI/ChatController.swift +++ b/TelegramUI/ChatController.swift @@ -154,6 +154,7 @@ public final class ChatController: TelegramController, KeyShortcutResponder, UID private var audioRecorderValue: ManagedAudioRecorder? private var audioRecorder = Promise() private var audioRecorderDisposable: Disposable? + private var audioRecorderStatusDisposable: Disposable? private var videoRecorderValue: InstantVideoController? private var tempVideoRecorderValue: InstantVideoController? @@ -207,6 +208,7 @@ public final class ChatController: TelegramController, KeyShortcutResponder, UID private let chatAdditionalDataDisposable = MetaDisposable() private var beginMediaRecordingRequestId: Int = 0 + private var lockMediaRecordingRequestId: Int? var purposefulAction: (() -> Void)? @@ -1319,7 +1321,8 @@ public final class ChatController: TelegramController, KeyShortcutResponder, UID } }) - self.audioRecorderDisposable = (self.audioRecorder.get() |> deliverOnMainQueue).start(next: { [weak self] audioRecorder in + self.audioRecorderDisposable = (self.audioRecorder.get() + |> deliverOnMainQueue).start(next: { [weak self] audioRecorder in if let strongSelf = self { if strongSelf.audioRecorderValue !== audioRecorder { strongSelf.audioRecorderValue = audioRecorder @@ -1329,7 +1332,7 @@ public final class ChatController: TelegramController, KeyShortcutResponder, UID $0.updatedInputTextPanelState { panelState in if let audioRecorder = audioRecorder { if panelState.mediaRecordingState == nil { - return panelState.withUpdatedMediaRecordingState(.audio(recorder: audioRecorder, isLocked: false)) + return panelState.withUpdatedMediaRecordingState(.audio(recorder: audioRecorder, isLocked: strongSelf.lockMediaRecordingRequestId == strongSelf.beginMediaRecordingRequestId)) } } else { return panelState.withUpdatedMediaRecordingState(nil) @@ -1337,12 +1340,21 @@ public final class ChatController: TelegramController, KeyShortcutResponder, UID return panelState } }) + strongSelf.audioRecorderStatusDisposable?.dispose() if let audioRecorder = audioRecorder { if !audioRecorder.beginWithTone { strongSelf.recorderFeedback?.impact(.light) } audioRecorder.start() + strongSelf.audioRecorderStatusDisposable = (audioRecorder.recordingState + |> deliverOnMainQueue).start(next: { value in + if case .stopped = value { + self?.stopMediaRecorder() + } + }) + } else { + strongSelf.audioRecorderStatusDisposable = nil } } } @@ -1386,6 +1398,10 @@ public final class ChatController: TelegramController, KeyShortcutResponder, UID } } strongSelf.present(videoRecorder, in: .window(.root)) + + if strongSelf.lockMediaRecordingRequestId == strongSelf.beginMediaRecordingRequestId { + videoRecorder.lockVideo() + } } if let previousVideoRecorderValue = previousVideoRecorderValue { @@ -1513,6 +1529,7 @@ public final class ChatController: TelegramController, KeyShortcutResponder, UID } self.urlPreviewQueryState?.1.dispose() self.audioRecorderDisposable?.dispose() + self.audioRecorderStatusDisposable?.dispose() self.videoRecorderDisposable?.dispose() self.buttonKeyboardMessageDisposable?.dispose() self.cachedDataDisposable?.dispose() @@ -1727,7 +1744,9 @@ public final class ChatController: TelegramController, KeyShortcutResponder, UID pinnedMessageUpdated = true } - if strongSelf.presentationInterfaceState.pinnedMessageId != pinnedMessageId || strongSelf.presentationInterfaceState.peerIsBlocked != peerIsBlocked || strongSelf.presentationInterfaceState.canReportPeer != canReport || pinnedMessageUpdated { + let callsDataUpdated = strongSelf.presentationInterfaceState.callsAvailable != callsAvailable || strongSelf.presentationInterfaceState.callsPrivate != callsPrivate + + if strongSelf.presentationInterfaceState.pinnedMessageId != pinnedMessageId || strongSelf.presentationInterfaceState.pinnedMessage?.stableVersion != pinnedMessage?.stableVersion || strongSelf.presentationInterfaceState.peerIsBlocked != peerIsBlocked || strongSelf.presentationInterfaceState.canReportPeer != canReport || pinnedMessageUpdated || callsDataUpdated { strongSelf.updateChatPresentationInterfaceState(animated: true, interactive: true, { state in return state.updatedPinnedMessageId(pinnedMessageId).updatedPinnedMessage(pinnedMessage).updatedPeerIsBlocked(peerIsBlocked).updatedCanReportPeer(canReport).updatedCallsAvailable(callsAvailable).updatedCallsPrivate(callsPrivate).updatedTitlePanelContext({ context in if pinnedMessageId != nil { @@ -2169,6 +2188,11 @@ public final class ChatController: TelegramController, KeyShortcutResponder, UID return $0.updatedInputMode({ _ in return updatedInputMode }).updatedInterfaceState({ $0.withUpdatedMessageActionsState({ $0.withUpdatedClosedButtonKeyboardMessageId(updatedClosedButtonKeyboardMessageId) }) }) }) } + }, openStickers: { [weak self] in + guard let strongSelf = self else { + return + } + strongSelf.chatDisplayNode.openStickers() }, editMessage: { [weak self] in if let strongSelf = self, let editMessage = strongSelf.presentationInterfaceState.interfaceState.editMessage { var disableUrlPreview = false @@ -2447,9 +2471,14 @@ public final class ChatController: TelegramController, KeyShortcutResponder, UID return } strongSelf.beginMediaRecordingRequestId += 1 - self?.stopMediaRecorder() + strongSelf.lockMediaRecordingRequestId = nil + strongSelf.stopMediaRecorder() }, lockMediaRecording: { [weak self] in - self?.lockMediaRecorder() + guard let strongSelf = self else { + return + } + strongSelf.lockMediaRecordingRequestId = strongSelf.beginMediaRecordingRequestId + strongSelf.lockMediaRecorder() }, deleteRecordedMedia: { [weak self] in self?.deleteMediaRecording() }, sendRecordedMedia: { [weak self] in @@ -4207,7 +4236,7 @@ public final class ChatController: TelegramController, KeyShortcutResponder, UID private func sendMediaRecording() { if let recordedMediaPreview = self.presentationInterfaceState.recordedMediaPreview { - let waveformBuffer = MemoryBuffer(data: recordedMediaPreview.waveform.samples) + let waveformBuffer = MemoryBuffer(data: recordedMediaPreview.waveform.makeBitstream()) self.chatDisplayNode.setupSendActionOnViewUpdate({ [weak self] in if let strongSelf = self { diff --git a/TelegramUI/ChatControllerNode.swift b/TelegramUI/ChatControllerNode.swift index 2ff557ef72..ddf7c3b6c3 100644 --- a/TelegramUI/ChatControllerNode.swift +++ b/TelegramUI/ChatControllerNode.swift @@ -92,6 +92,7 @@ class ChatControllerNode: ASDisplayNode, UIScrollViewDelegate { private var overlayContextPanelNode: ChatInputContextPanelNode? private var inputNode: ChatInputNode? + private var disappearingNode: ChatInputNode? private var textInputPanelNode: ChatTextInputPanelNode? private var inputMediaNode: ChatMediaInputNode? @@ -168,6 +169,8 @@ class ChatControllerNode: ASDisplayNode, UIScrollViewDelegate { } } + private var openStickersDisposable: Disposable? + init(account: Account, chatLocation: ChatLocation, messageId: MessageId?, controllerInteraction: ChatControllerInteraction, chatPresentationInterfaceState: ChatPresentationInterfaceState, automaticMediaDownloadSettings: AutomaticMediaDownloadSettings, navigationBar: NavigationBar?, controller: ChatController?) { self.account = account self.chatLocation = chatLocation @@ -260,6 +263,7 @@ class ChatControllerNode: ASDisplayNode, UIScrollViewDelegate { strongSelf.requestLayout(.animated(duration: 0.1, curve: .easeInOut)) } } + var lastSendTimestamp = 0.0 self.textInputPanelNode?.sendMessage = { [weak self] in if let strongSelf = self, let textInputPanelNode = strongSelf.inputPanelNode as? ChatTextInputPanelNode { if textInputPanelNode.textInputNode?.isFirstResponder() ?? false { @@ -274,6 +278,12 @@ class ChatControllerNode: ASDisplayNode, UIScrollViewDelegate { if let _ = effectivePresentationInterfaceState.interfaceState.editMessage { strongSelf.interfaceInteraction?.editMessage() } else { + let timestamp = CACurrentMediaTime() + if lastSendTimestamp + 0.15 > timestamp { + return + } + lastSendTimestamp = timestamp + strongSelf.updateTypingActivity(false) var messages: [EnqueueMessage] = [] @@ -330,6 +340,10 @@ class ChatControllerNode: ASDisplayNode, UIScrollViewDelegate { } } + deinit { + self.openStickersDisposable?.dispose() + } + override func didLoad() { super.didLoad() @@ -592,7 +606,7 @@ class ChatControllerNode: ASDisplayNode, UIScrollViewDelegate { self.insertSubnode(inputNode, aboveSubnode: self.inputPanelBackgroundNode) } } - inputNodeHeightAndOverflow = inputNode.updateLayout(width: layout.size.width, leftInset: layout.safeInsets.left, rightInset: layout.safeInsets.right, bottomInset: cleanInsets.bottom, standardInputHeight: layout.standardInputHeight, inputHeight: layout.inputHeight ?? 0.0, maximumHeight: maximumInputNodeHeight, inputPanelHeight: inputPanelNodeBaseHeight, transition: immediatelyLayoutInputNodeAndAnimateAppearance ? .immediate : transition, interfaceState: self.chatPresentationInterfaceState) + inputNodeHeightAndOverflow = inputNode.updateLayout(width: layout.size.width, leftInset: layout.safeInsets.left, rightInset: layout.safeInsets.right, bottomInset: cleanInsets.bottom, standardInputHeight: layout.standardInputHeight, inputHeight: layout.inputHeight ?? 0.0, maximumHeight: maximumInputNodeHeight, inputPanelHeight: inputPanelNodeBaseHeight, transition: immediatelyLayoutInputNodeAndAnimateAppearance ? .immediate : transition, interfaceState: self.chatPresentationInterfaceState, isVisible: true) } else if let inputNode = self.inputNode { dismissedInputNode = inputNode self.inputNode = nil @@ -670,7 +684,7 @@ class ChatControllerNode: ASDisplayNode, UIScrollViewDelegate { } if let inputMediaNode = self.inputMediaNode, inputMediaNode != self.inputNode { - let _ = inputMediaNode.updateLayout(width: layout.size.width, leftInset: layout.safeInsets.left, rightInset: layout.safeInsets.right, bottomInset: cleanInsets.bottom, standardInputHeight: layout.standardInputHeight, inputHeight: layout.inputHeight ?? 0.0, maximumHeight: maximumInputNodeHeight, inputPanelHeight: inputPanelSize?.height ?? 0.0, transition: .immediate, interfaceState: self.chatPresentationInterfaceState) + let _ = inputMediaNode.updateLayout(width: layout.size.width, leftInset: layout.safeInsets.left, rightInset: layout.safeInsets.right, bottomInset: cleanInsets.bottom, standardInputHeight: layout.standardInputHeight, inputHeight: layout.inputHeight ?? 0.0, maximumHeight: maximumInputNodeHeight, inputPanelHeight: inputPanelSize?.height ?? 0.0, transition: .immediate, interfaceState: self.chatPresentationInterfaceState, isVisible: false) } transition.updateFrame(node: self.titleAccessoryPanelContainer, frame: CGRect(origin: CGPoint(x: 0.0, y: insets.top), size: CGSize(width: layout.size.width, height: 56.0))) @@ -1214,7 +1228,17 @@ class ChatControllerNode: ASDisplayNode, UIScrollViewDelegate { }) } + if let disappearingNode = self.disappearingNode { + let targetY: CGFloat + if cleanInsets.bottom.isLess(than: insets.bottom) { + targetY = layout.size.height - insets.bottom + } else { + targetY = layout.size.height + } + transition.updateFrame(node: disappearingNode, frame: CGRect(origin: CGPoint(x: 0.0, y: targetY), size: CGSize(width: layout.size.width, height: max(insets.bottom, disappearingNode.bounds.size.height)))) + } if let dismissedInputNode = dismissedInputNode { + self.disappearingNode = dismissedInputNode let targetY: CGFloat if cleanInsets.bottom.isLess(than: insets.bottom) { targetY = layout.size.height - insets.bottom @@ -1222,8 +1246,11 @@ class ChatControllerNode: ASDisplayNode, UIScrollViewDelegate { targetY = layout.size.height } transition.updateFrame(node: dismissedInputNode, frame: CGRect(origin: CGPoint(x: 0.0, y: targetY), size: CGSize(width: layout.size.width, height: max(insets.bottom, dismissedInputNode.bounds.size.height))), force: true, completion: { [weak self, weak dismissedInputNode] completed in - if completed, let dismissedInputNode = dismissedInputNode { + if let dismissedInputNode = dismissedInputNode { if let strongSelf = self { + if strongSelf.disappearingNode === dismissedInputNode { + strongSelf.disappearingNode = nil + } if strongSelf.inputNode !== dismissedInputNode { dismissedInputNode.alpha = 0.0 dismissedInputNode.layer.animateAlpha(from: 1.0, to: 0.0, duration: 0.2, completion: { [weak dismissedInputNode] completed in @@ -1345,6 +1372,14 @@ class ChatControllerNode: ASDisplayNode, UIScrollViewDelegate { self.emptyNode?.isHidden = false } + if let openStickersDisposable = self.openStickersDisposable { + if case .media = chatPresentationInterfaceState.inputMode { + } else { + openStickersDisposable.dispose() + self.openStickersDisposable = nil + } + } + let layoutTransition: ContainedViewLayoutTransition = transition if updatedInputFocus { @@ -1472,7 +1507,7 @@ class ChatControllerNode: ASDisplayNode, UIScrollViewDelegate { inputNode.interfaceInteraction = interfaceInteraction self.inputMediaNode = inputNode if let (validLayout, _) = self.validLayout { - let _ = inputNode.updateLayout(width: validLayout.size.width, leftInset: validLayout.safeInsets.left, rightInset: validLayout.safeInsets.right, bottomInset: validLayout.intrinsicInsets.bottom, standardInputHeight: validLayout.standardInputHeight, inputHeight: validLayout.inputHeight ?? 0.0, maximumHeight: validLayout.standardInputHeight, inputPanelHeight: 44.0, transition: .immediate, interfaceState: self.chatPresentationInterfaceState) + let _ = inputNode.updateLayout(width: validLayout.size.width, leftInset: validLayout.safeInsets.left, rightInset: validLayout.safeInsets.right, bottomInset: validLayout.intrinsicInsets.bottom, standardInputHeight: validLayout.standardInputHeight, inputHeight: validLayout.inputHeight ?? 0.0, maximumHeight: validLayout.standardInputHeight, inputPanelHeight: 44.0, transition: .immediate, interfaceState: self.chatPresentationInterfaceState, isVisible: false) } } } @@ -1899,4 +1934,17 @@ class ChatControllerNode: ASDisplayNode, UIScrollViewDelegate { self.keyboardGestureBeginLocation = nil } } + + func openStickers() { + if let inputMediaNode = self.inputMediaNode, self.openStickersDisposable == nil { + self.openStickersDisposable = (inputMediaNode.ready + |> take(1) + |> deliverOnMainQueue).start(next: { [weak self] in + self?.openStickersDisposable = nil + self?.interfaceInteraction?.updateInputModeAndDismissedButtonKeyboardMessageId({ state in + return (.media(mode: .other, expanded: nil), state.interfaceState.messageActionsState.closedButtonKeyboardMessageId) + }) + }) + } + } } diff --git a/TelegramUI/ChatHoleItem.swift b/TelegramUI/ChatHoleItem.swift index 838c71e665..5cc04def5b 100644 --- a/TelegramUI/ChatHoleItem.swift +++ b/TelegramUI/ChatHoleItem.swift @@ -18,21 +18,21 @@ class ChatHoleItem: ListViewItem { //self.header = ChatMessageDateHeader(timestamp: index.timestamp, theme: theme, strings: strings) } - func nodeConfiguredForParams(async: @escaping (@escaping () -> Void) -> Void, params: ListViewItemLayoutParams, synchronousLoads: Bool, previousItem: ListViewItem?, nextItem: ListViewItem?, completion: @escaping (ListViewItemNode, @escaping () -> (Signal?, () -> Void)) -> Void) { + func nodeConfiguredForParams(async: @escaping (@escaping () -> Void) -> Void, params: ListViewItemLayoutParams, synchronousLoads: Bool, previousItem: ListViewItem?, nextItem: ListViewItem?, completion: @escaping (ListViewItemNode, @escaping () -> (Signal?, (ListViewItemApply) -> Void)) -> Void) { async { let node = ChatHoleItemNode() node.layoutForParams(params, item: self, previousItem: previousItem, nextItem: nextItem) Queue.mainQueue().async { completion(node, { - return (nil, {}) + return (nil, { _ in }) }) } } } - func updateNode(async: @escaping (@escaping () -> Void) -> Void, node: @escaping () -> ListViewItemNode, params: ListViewItemLayoutParams, previousItem: ListViewItem?, nextItem: ListViewItem?, animation: ListViewItemUpdateAnimation, completion: @escaping (ListViewItemNodeLayout, @escaping () -> Void) -> Void) { + func updateNode(async: @escaping (@escaping () -> Void) -> Void, node: @escaping () -> ListViewItemNode, params: ListViewItemLayoutParams, previousItem: ListViewItem?, nextItem: ListViewItem?, animation: ListViewItemUpdateAnimation, completion: @escaping (ListViewItemNodeLayout, @escaping (ListViewItemApply) -> Void) -> Void) { Queue.mainQueue().async { - completion(ListViewItemNodeLayout(contentSize: node().contentSize, insets: node().insets), { + completion(ListViewItemNodeLayout(contentSize: node().contentSize, insets: node().insets), { _ in }) } } diff --git a/TelegramUI/ChatInputNode.swift b/TelegramUI/ChatInputNode.swift index c3db7a0cf1..ab36507362 100644 --- a/TelegramUI/ChatInputNode.swift +++ b/TelegramUI/ChatInputNode.swift @@ -1,11 +1,15 @@ import Foundation import Display import AsyncDisplayKit +import SwiftSignalKit class ChatInputNode: ASDisplayNode { var interfaceInteraction: ChatPanelInterfaceInteraction? + var ready: Signal { + return .single(Void()) + } - func updateLayout(width: CGFloat, leftInset: CGFloat, rightInset: CGFloat, bottomInset: CGFloat, standardInputHeight: CGFloat, inputHeight: CGFloat, maximumHeight: CGFloat, inputPanelHeight: CGFloat, transition: ContainedViewLayoutTransition, interfaceState: ChatPresentationInterfaceState) -> (CGFloat, CGFloat) { + func updateLayout(width: CGFloat, leftInset: CGFloat, rightInset: CGFloat, bottomInset: CGFloat, standardInputHeight: CGFloat, inputHeight: CGFloat, maximumHeight: CGFloat, inputPanelHeight: CGFloat, transition: ContainedViewLayoutTransition, interfaceState: ChatPresentationInterfaceState, isVisible: Bool) -> (CGFloat, CGFloat) { return (0.0, 0.0) } } diff --git a/TelegramUI/ChatInterfaceStateContextMenus.swift b/TelegramUI/ChatInterfaceStateContextMenus.swift index 42f63807cc..6751b02cd7 100644 --- a/TelegramUI/ChatInterfaceStateContextMenus.swift +++ b/TelegramUI/ChatInterfaceStateContextMenus.swift @@ -563,9 +563,12 @@ func chatAvailableMessageActions(postbox: Postbox, accountPeerId: PeerId, messag banPeer = nil } } - if message.id.peerId.namespace != Namespaces.Peer.SecretChat && !message.containsSecretMedia && !isAction { - optionsMap[id]!.insert(.forward) + if !message.containsSecretMedia && !isAction { + if message.id.peerId.namespace != Namespaces.Peer.SecretChat { + optionsMap[id]!.insert(.forward) + } } + if !message.flags.contains(.Incoming) { optionsMap[id]!.insert(.deleteGlobally) } else { diff --git a/TelegramUI/ChatItemGalleryFooterContentNode.swift b/TelegramUI/ChatItemGalleryFooterContentNode.swift index e8be44f626..1d4f959ce8 100644 --- a/TelegramUI/ChatItemGalleryFooterContentNode.swift +++ b/TelegramUI/ChatItemGalleryFooterContentNode.swift @@ -702,7 +702,7 @@ final class ChatItemGalleryFooterContentNode: GalleryFooterContentNode { var subject: ShareControllerSubject = ShareControllerSubject.messages(messages) for m in messages[0].media { if let image = m as? TelegramMediaImage { - subject = .image(image.representations) + subject = .image(image.representations.map({ ImageRepresentationWithReference(representation: $0, reference: .media(media: .message(message: MessageReference(messages[0]), media: m), resource: $0.resource)) })) } else if let webpage = m as? TelegramMediaWebpage, case let .Loaded(content) = webpage.content { if content.embedType == "iframe" { let item = OpenInItem.url(url: content.url) diff --git a/TelegramUI/ChatListController.swift b/TelegramUI/ChatListController.swift index 69c0b7fc5a..1b931b4cdc 100644 --- a/TelegramUI/ChatListController.swift +++ b/TelegramUI/ChatListController.swift @@ -78,7 +78,7 @@ public class ChatListController: TelegramController, KeyShortcutResponder, UIVie self.navigationItem.backBarButtonItem = UIBarButtonItem(title: self.presentationData.strings.DialogList_Title, style: .plain, target: nil, action: nil) self.scrollToTop = { [weak self] in - self?.chatListDisplayNode.chatListNode.scrollToPosition(.top) + self?.chatListDisplayNode.scrollToTop() } self.scrollToTopWithTabBar = { [weak self] in guard let strongSelf = self else { @@ -328,7 +328,10 @@ public class ChatListController: TelegramController, KeyShortcutResponder, UIVie actionSheet?.dismissAnimated() if let strongSelf = self { - let _ = removePeerChat(postbox: strongSelf.account.postbox, peerId: peerId, reportChatSpam: false).start() + strongSelf.chatListDisplayNode.chatListNode.setCurrentRemovingPeerId(peerId) + let _ = removePeerChat(postbox: strongSelf.account.postbox, peerId: peerId, reportChatSpam: false).start(completed: { + self?.chatListDisplayNode.chatListNode.setCurrentRemovingPeerId(nil) + }) } })) @@ -337,7 +340,10 @@ public class ChatListController: TelegramController, KeyShortcutResponder, UIVie actionSheet?.dismissAnimated() if let strongSelf = self { - let _ = removePeerChat(postbox: strongSelf.account.postbox, peerId: peerId, reportChatSpam: false).start() + strongSelf.chatListDisplayNode.chatListNode.setCurrentRemovingPeerId(peerId) + let _ = removePeerChat(postbox: strongSelf.account.postbox, peerId: peerId, reportChatSpam: false).start(completed: { + self?.chatListDisplayNode.chatListNode.setCurrentRemovingPeerId(peerId) + }) let _ = requestUpdatePeerIsBlocked(account: strongSelf.account, peerId: peer.id, isBlocked: true).start() } })) diff --git a/TelegramUI/ChatListControllerNode.swift b/TelegramUI/ChatListControllerNode.swift index d2a98dc783..8639ab6c05 100644 --- a/TelegramUI/ChatListControllerNode.swift +++ b/TelegramUI/ChatListControllerNode.swift @@ -197,4 +197,12 @@ class ChatListControllerNode: ASDisplayNode { self.searchDisplayController = nil } } + + func scrollToTop() { + if let searchDisplayController = self.searchDisplayController { + searchDisplayController.contentNode.scrollToTop() + } else { + self.chatListNode.scrollToPosition(.top) + } + } } diff --git a/TelegramUI/ChatListHoleItem.swift b/TelegramUI/ChatListHoleItem.swift index 91d5d7a349..ba8de93444 100644 --- a/TelegramUI/ChatListHoleItem.swift +++ b/TelegramUI/ChatListHoleItem.swift @@ -16,7 +16,7 @@ class ChatListHoleItem: ListViewItem { self.theme = theme } - func nodeConfiguredForParams(async: @escaping (@escaping () -> Void) -> Void, params: ListViewItemLayoutParams, synchronousLoads: Bool, previousItem: ListViewItem?, nextItem: ListViewItem?, completion: @escaping (ListViewItemNode, @escaping () -> (Signal?, () -> Void)) -> Void) { + func nodeConfiguredForParams(async: @escaping (@escaping () -> Void) -> Void, params: ListViewItemLayoutParams, synchronousLoads: Bool, previousItem: ListViewItem?, nextItem: ListViewItem?, completion: @escaping (ListViewItemNode, @escaping () -> (Signal?, (ListViewItemApply) -> Void)) -> Void) { async { let node = ChatListHoleItemNode() node.relativePosition = (first: previousItem == nil, last: nextItem == nil) @@ -24,13 +24,13 @@ class ChatListHoleItem: ListViewItem { node.layoutForParams(params, item: self, previousItem: previousItem, nextItem: nextItem) Queue.mainQueue().async { completion(node, { - return (nil, {}) + return (nil, { _ in }) }) } } } - func updateNode(async: @escaping (@escaping () -> Void) -> Void, node: @escaping () -> ListViewItemNode, params: ListViewItemLayoutParams, previousItem: ListViewItem?, nextItem: ListViewItem?, animation: ListViewItemUpdateAnimation, completion: @escaping (ListViewItemNodeLayout, @escaping () -> Void) -> Void) { + func updateNode(async: @escaping (@escaping () -> Void) -> Void, node: @escaping () -> ListViewItemNode, params: ListViewItemLayoutParams, previousItem: ListViewItem?, nextItem: ListViewItem?, animation: ListViewItemUpdateAnimation, completion: @escaping (ListViewItemNodeLayout, @escaping (ListViewItemApply) -> Void) -> Void) { Queue.mainQueue().async { assert(node() is ChatListHoleItemNode) if let nodeValue = node() as? ChatListHoleItemNode { @@ -42,7 +42,7 @@ class ChatListHoleItem: ListViewItem { let (nodeLayout, apply) = layout(self, params, first, last) Queue.mainQueue().async { - completion(nodeLayout, { + completion(nodeLayout, { _ in apply() if let nodeValue = node() as? ChatListHoleItemNode { nodeValue.updateBackgroundAndSeparatorsLayout() diff --git a/TelegramUI/ChatListItem.swift b/TelegramUI/ChatListItem.swift index 9cb181fa3e..fcaf9b90a9 100644 --- a/TelegramUI/ChatListItem.swift +++ b/TelegramUI/ChatListItem.swift @@ -50,7 +50,7 @@ class ChatListItem: ListViewItem { self.interaction = interaction } - func nodeConfiguredForParams(async: @escaping (@escaping () -> Void) -> Void, params: ListViewItemLayoutParams, synchronousLoads: Bool, previousItem: ListViewItem?, nextItem: ListViewItem?, completion: @escaping (ListViewItemNode, @escaping () -> (Signal?, () -> Void)) -> Void) { + func nodeConfiguredForParams(async: @escaping (@escaping () -> Void) -> Void, params: ListViewItemLayoutParams, synchronousLoads: Bool, previousItem: ListViewItem?, nextItem: ListViewItem?, completion: @escaping (ListViewItemNode, @escaping () -> (Signal?, (ListViewItemApply) -> Void)) -> Void) { async { let node = ChatListItemNode() let (first, last, firstWithHeader, nextIsPinned) = ChatListItem.mergeType(item: self, previousItem: previousItem, nextItem: nextItem) @@ -63,7 +63,7 @@ class ChatListItem: ListViewItem { Queue.mainQueue().async { completion(node, { - return (nil, { + return (nil, { _ in node.setupItem(item: self) apply(false) node.updateIsHighlighted(transition: .immediate) @@ -73,7 +73,7 @@ class ChatListItem: ListViewItem { } } - func updateNode(async: @escaping (@escaping () -> Void) -> Void, node: @escaping () -> ListViewItemNode, params: ListViewItemLayoutParams, previousItem: ListViewItem?, nextItem: ListViewItem?, animation: ListViewItemUpdateAnimation, completion: @escaping (ListViewItemNodeLayout, @escaping () -> Void) -> Void) { + func updateNode(async: @escaping (@escaping () -> Void) -> Void, node: @escaping () -> ListViewItemNode, params: ListViewItemLayoutParams, previousItem: ListViewItem?, nextItem: ListViewItem?, animation: ListViewItemUpdateAnimation, completion: @escaping (ListViewItemNodeLayout, @escaping (ListViewItemApply) -> Void) -> Void) { Queue.mainQueue().async { assert(node() is ChatListItemNode) if let nodeValue = node() as? ChatListItemNode { @@ -88,7 +88,7 @@ class ChatListItem: ListViewItem { let (nodeLayout, apply) = layout(self, params, first, last, firstWithHeader, nextIsPinned) Queue.mainQueue().async { - completion(nodeLayout, { + completion(nodeLayout, { _ in apply(animated) }) } diff --git a/TelegramUI/ChatListNode.swift b/TelegramUI/ChatListNode.swift index 588914e5f6..1c8c796df7 100644 --- a/TelegramUI/ChatListNode.swift +++ b/TelegramUI/ChatListNode.swift @@ -336,6 +336,11 @@ final class ChatListNode: ListView { var isEmptyUpdated: ((Bool) -> Void)? private var wasEmpty: Bool? + private let currentRemovingPeerId = Atomic(value: nil) + func setCurrentRemovingPeerId(_ peerId: PeerId?) { + let _ = self.currentRemovingPeerId.swap(peerId) + } + init(account: Account, groupId: PeerGroupId?, controlsHistoryPreload: Bool, mode: ChatListNodeMode, theme: PresentationTheme, strings: PresentationStrings, dateTimeFormat: PresentationDateTimeFormat, nameSortOrder: PresentationPersonNameOrder, nameDisplayOrder: PresentationPersonNameOrder, disableAnimations: Bool) { self.account = account self.controlsHistoryPreload = controlsHistoryPreload @@ -431,13 +436,14 @@ final class ChatListNode: ListView { let viewProcessingQueue = self.viewProcessingQueue let chatListViewUpdate = self.chatListLocation.get() - |> distinctUntilChanged - |> mapToSignal { location in - return chatListViewForLocation(groupId: groupId, location: location, account: account) - } + |> distinctUntilChanged + |> mapToSignal { location in + return chatListViewForLocation(groupId: groupId, location: location, account: account) + } let previousState = Atomic(value: self.currentState) let previousView = Atomic(value: nil) + let currentRemovingPeerId = self.currentRemovingPeerId let savedMessagesPeer: Signal if case let .peers(filter) = mode, filter == [.onlyWriteable] { @@ -453,39 +459,38 @@ final class ChatListNode: ListView { let entries = chatListNodeEntriesForView(update.view, state: state, savedMessagesPeer: savedMessagesPeer, mode: mode).filter { entry in switch entry { case let .PeerEntry(_, _, _, _, _, _, peer, _, _, _, _, _, _): - //ChatListNodePeersFilter switch mode { - case .chatList: - return true - case let .peers(filter): - guard !filter.contains(.excludeSavedMessages) || peer.peerId != currentPeerId else { return false } - guard !filter.contains(.excludeSecretChats) || peer.peerId.namespace != Namespaces.Peer.SecretChat else { return false } - guard !filter.contains(.onlyPrivateChats) || peer.peerId.namespace == Namespaces.Peer.CloudUser else { return false } + case .chatList: + return true + case let .peers(filter): + guard !filter.contains(.excludeSavedMessages) || peer.peerId != currentPeerId else { return false } + guard !filter.contains(.excludeSecretChats) || peer.peerId.namespace != Namespaces.Peer.SecretChat else { return false } + guard !filter.contains(.onlyPrivateChats) || peer.peerId.namespace == Namespaces.Peer.CloudUser else { return false } - if filter.contains(.onlyGroups) { - var isGroup: Bool = false - if let peer = peer.chatMainPeer as? TelegramChannel, case .group = peer.info { - isGroup = true - } else if peer.peerId.namespace == Namespaces.Peer.CloudGroup { - isGroup = true + if filter.contains(.onlyGroups) { + var isGroup: Bool = false + if let peer = peer.chatMainPeer as? TelegramChannel, case .group = peer.info { + isGroup = true + } else if peer.peerId.namespace == Namespaces.Peer.CloudGroup { + isGroup = true + } + if !isGroup { + return false + } } - if !isGroup { - return false + + if filter.contains(.onlyChannels) { + if let peer = peer.chatMainPeer as? TelegramChannel, case .broadcast = peer.info { + return true + } else { + return false + } } + + return true } - - if filter.contains(.onlyChannels) { - if let peer = peer.chatMainPeer as? TelegramChannel, case .broadcast = peer.info { - return true - } else { - return false - } - } - + default: return true - } - default: - return true } } @@ -533,26 +538,36 @@ final class ChatListNode: ListView { } } + let removingPeerId = currentRemovingPeerId.with { $0 } + var disableAnimations = state.presentationData.disableAnimations if previousState.editing != state.editing { disableAnimations = false } else { var previousPinnedCount = 0 var updatedPinnedCount = 0 + var didIncludeRemovingPeerId = false if let previous = previousView { for entry in previous.filteredEntries { if case let .PeerEntry(index, _, _, _, _, _, _, _, _, _, _, _, _) = entry { if index.pinningIndex != nil { previousPinnedCount += 1 } + if index.messageIndex.id.peerId == removingPeerId { + didIncludeRemovingPeerId = true + } } } } + var doesIncludeRemovingPeerId = false for entry in processedView.filteredEntries { if case let .PeerEntry(index, _, _, _, _, _, _, _, _, _, _, _, _) = entry { if index.pinningIndex != nil { updatedPinnedCount += 1 } + if index.messageIndex.id.peerId == removingPeerId { + doesIncludeRemovingPeerId = true + } } } if previousPinnedCount != updatedPinnedCount { @@ -561,11 +576,19 @@ final class ChatListNode: ListView { if previousState.selectedPeerIds != state.selectedPeerIds { disableAnimations = false } + if !doesIncludeRemovingPeerId, didIncludeRemovingPeerId { + disableAnimations = false + } } - return preparedChatListNodeViewTransition(from: previousView, to: processedView, reason: reason, disableAnimations: disableAnimations, account: account, scrollPosition: updatedScrollPosition) - |> map({ mappedChatListNodeViewListTransition(account: account, nodeInteraction: nodeInteraction, peerGroupId: groupId, mode: mode, transition: $0) }) - |> runOn(prepareOnMainQueue ? Queue.mainQueue() : viewProcessingQueue) + var searchMode = false + if case .peers = mode { + searchMode = true + } + + return preparedChatListNodeViewTransition(from: previousView, to: processedView, reason: reason, disableAnimations: disableAnimations, account: account, scrollPosition: updatedScrollPosition, searchMode: searchMode) + |> map({ mappedChatListNodeViewListTransition(account: account, nodeInteraction: nodeInteraction, peerGroupId: groupId, mode: mode, transition: $0) }) + |> runOn(prepareOnMainQueue ? Queue.mainQueue() : viewProcessingQueue) } let appliedTransition = chatListNodeViewTransition |> deliverOnMainQueue |> mapToQueue { [weak self] transition -> Signal in diff --git a/TelegramUI/ChatListRecentPeersListItem.swift b/TelegramUI/ChatListRecentPeersListItem.swift index ffc7bee5fe..046dcd117b 100644 --- a/TelegramUI/ChatListRecentPeersListItem.swift +++ b/TelegramUI/ChatListRecentPeersListItem.swift @@ -26,7 +26,7 @@ class ChatListRecentPeersListItem: ListViewItem { self.header = nil } - func nodeConfiguredForParams(async: @escaping (@escaping () -> Void) -> Void, params: ListViewItemLayoutParams, synchronousLoads: Bool, previousItem: ListViewItem?, nextItem: ListViewItem?, completion: @escaping (ListViewItemNode, @escaping () -> (Signal?, () -> Void)) -> Void) { + func nodeConfiguredForParams(async: @escaping (@escaping () -> Void) -> Void, params: ListViewItemLayoutParams, synchronousLoads: Bool, previousItem: ListViewItem?, nextItem: ListViewItem?, completion: @escaping (ListViewItemNode, @escaping () -> (Signal?, (ListViewItemApply) -> Void)) -> Void) { async { let node = ChatListRecentPeersListItemNode() let makeLayout = node.asyncLayout() @@ -38,15 +38,15 @@ class ChatListRecentPeersListItem: ListViewItem { } } - func updateNode(async: @escaping (@escaping () -> Void) -> Void, node: @escaping () -> ListViewItemNode, params: ListViewItemLayoutParams, previousItem: ListViewItem?, nextItem: ListViewItem?, animation: ListViewItemUpdateAnimation, completion: @escaping (ListViewItemNodeLayout, @escaping () -> Void) -> Void) { + func updateNode(async: @escaping (@escaping () -> Void) -> Void, node: @escaping () -> ListViewItemNode, params: ListViewItemLayoutParams, previousItem: ListViewItem?, nextItem: ListViewItem?, animation: ListViewItemUpdateAnimation, completion: @escaping (ListViewItemNodeLayout, @escaping (ListViewItemApply) -> Void) -> Void) { Queue.mainQueue().async { if let nodeValue = node() as? ChatListRecentPeersListItemNode { let layout = nodeValue.asyncLayout() async { let (nodeLayout, apply) = layout(self, params, nextItem != nil) Queue.mainQueue().async { - completion(nodeLayout, { - apply().1() + completion(nodeLayout, { info in + apply().1(info) }) } } @@ -87,7 +87,7 @@ class ChatListRecentPeersListItemNode: ListViewItemNode { } } - func asyncLayout() -> (_ item: ChatListRecentPeersListItem, _ params: ListViewItemLayoutParams, _ last: Bool) -> (ListViewItemNodeLayout, () -> (Signal?, () -> Void)) { + func asyncLayout() -> (_ item: ChatListRecentPeersListItem, _ params: ListViewItemLayoutParams, _ last: Bool) -> (ListViewItemNodeLayout, () -> (Signal?, (ListViewItemApply) -> Void)) { let currentItem = self.item return { [weak self] item, params, last in @@ -99,7 +99,7 @@ class ChatListRecentPeersListItemNode: ListViewItemNode { updatedTheme = item.theme } - return (nil, { + return (nil, { _ in if let strongSelf = self { strongSelf.item = item diff --git a/TelegramUI/ChatListSearchContainerNode.swift b/TelegramUI/ChatListSearchContainerNode.swift index fb2584e30a..68930afec4 100644 --- a/TelegramUI/ChatListSearchContainerNode.swift +++ b/TelegramUI/ChatListSearchContainerNode.swift @@ -586,7 +586,9 @@ final class ChatListSearchContainerNode: SearchDisplayControllerContentNode { self.presentationDataPromise = Promise(ChatListPresentationData(theme: self.presentationData.theme, strings: self.presentationData.strings, dateTimeFormat: self.presentationData.dateTimeFormat, nameSortOrder: self.presentationData.nameSortOrder, nameDisplayOrder: self.presentationData.nameDisplayOrder, disableAnimations: self.presentationData.disableAnimations)) self.recentListNode = ListView() + self.recentListNode.verticalScrollIndicatorColor = self.presentationData.theme.list.scrollIndicatorColor self.listNode = ListView() + self.listNode.verticalScrollIndicatorColor = self.presentationData.theme.list.scrollIndicatorColor self.statePromise = ValuePromise(self.stateValue, ignoreRepeated: true) @@ -1015,6 +1017,8 @@ final class ChatListSearchContainerNode: SearchDisplayControllerContentNode { private func updateTheme(theme: PresentationTheme) { self.backgroundColor = theme.chatList.backgroundColor + self.recentListNode.verticalScrollIndicatorColor = theme.list.scrollIndicatorColor + self.listNode.verticalScrollIndicatorColor = theme.list.scrollIndicatorColor } private func updateState(_ f: (ChatListSearchContainerNodeState) -> ChatListSearchContainerNodeState) { @@ -1188,4 +1192,12 @@ final class ChatListSearchContainerNode: SearchDisplayControllerContentNode { } } } + + override func scrollToTop() { + if !self.listNode.isHidden { + self.listNode.transaction(deleteIndices: [], insertIndicesAndItems: [], updateIndicesAndItems: [], options: [.Synchronous, .LowLatency], scrollToItem: ListViewScrollToItem(index: 0, position: .top(0.0), animated: true, curve: .Default(duration: nil), directionHint: .Up), updateSizeAndInsets: nil, stationaryItemRange: nil, updateOpaqueState: nil, completion: { _ in }) + } else { + self.recentListNode.transaction(deleteIndices: [], insertIndicesAndItems: [], updateIndicesAndItems: [], options: [.Synchronous, .LowLatency], scrollToItem: ListViewScrollToItem(index: 0, position: .top(0.0), animated: true, curve: .Default(duration: nil), directionHint: .Up), updateSizeAndInsets: nil, stationaryItemRange: nil, updateOpaqueState: nil, completion: { _ in }) + } + } } diff --git a/TelegramUI/ChatListSearchItem.swift b/TelegramUI/ChatListSearchItem.swift index f0c5f12e44..59295fc96d 100644 --- a/TelegramUI/ChatListSearchItem.swift +++ b/TelegramUI/ChatListSearchItem.swift @@ -22,7 +22,7 @@ class ChatListSearchItem: ListViewItem { self.activate = activate } - func nodeConfiguredForParams(async: @escaping (@escaping () -> Void) -> Void, params: ListViewItemLayoutParams, synchronousLoads: Bool, previousItem: ListViewItem?, nextItem: ListViewItem?, completion: @escaping (ListViewItemNode, @escaping () -> (Signal?, () -> Void)) -> Void) { + func nodeConfiguredForParams(async: @escaping (@escaping () -> Void) -> Void, params: ListViewItemLayoutParams, synchronousLoads: Bool, previousItem: ListViewItem?, nextItem: ListViewItem?, completion: @escaping (ListViewItemNode, @escaping () -> (Signal?, (ListViewItemApply) -> Void)) -> Void) { async { let node = ChatListSearchItemNode() node.placeholder = self.placeholder @@ -40,7 +40,7 @@ class ChatListSearchItem: ListViewItem { node.activate = self.activate Queue.mainQueue().async { completion(node, { - return (nil, { + return (nil, { _ in apply(false) }) }) @@ -48,7 +48,7 @@ class ChatListSearchItem: ListViewItem { } } - func updateNode(async: @escaping (@escaping () -> Void) -> Void, node: @escaping () -> ListViewItemNode, params: ListViewItemLayoutParams, previousItem: ListViewItem?, nextItem: ListViewItem?, animation: ListViewItemUpdateAnimation, completion: @escaping (ListViewItemNodeLayout, @escaping () -> Void) -> Void) { + func updateNode(async: @escaping (@escaping () -> Void) -> Void, node: @escaping () -> ListViewItemNode, params: ListViewItemLayoutParams, previousItem: ListViewItem?, nextItem: ListViewItem?, animation: ListViewItemUpdateAnimation, completion: @escaping (ListViewItemNodeLayout, @escaping (ListViewItemApply) -> Void) -> Void) { Queue.mainQueue().async { if let nodeValue = node() as? ChatListSearchItemNode { nodeValue.placeholder = self.placeholder @@ -60,7 +60,7 @@ class ChatListSearchItem: ListViewItem { } let (nodeLayout, apply) = layout(self, params, nextIsPinned, self.isEnabled) Queue.mainQueue().async { - completion(nodeLayout, { + completion(nodeLayout, { _ in apply(animation.isAnimated) }) } diff --git a/TelegramUI/ChatListViewTransition.swift b/TelegramUI/ChatListViewTransition.swift index 5ca0474eba..293c9be198 100644 --- a/TelegramUI/ChatListViewTransition.swift +++ b/TelegramUI/ChatListViewTransition.swift @@ -44,7 +44,7 @@ enum ChatListNodeViewScrollPosition { case index(index: ChatListIndex, position: ListViewScrollPosition, directionHint: ListViewScrollToItemDirectionHint, animated: Bool) } -func preparedChatListNodeViewTransition(from fromView: ChatListNodeView?, to toView: ChatListNodeView, reason: ChatListNodeViewTransitionReason, disableAnimations: Bool, account: Account, scrollPosition: ChatListNodeViewScrollPosition?) -> Signal { +func preparedChatListNodeViewTransition(from fromView: ChatListNodeView?, to toView: ChatListNodeView, reason: ChatListNodeViewTransitionReason, disableAnimations: Bool, account: Account, scrollPosition: ChatListNodeViewScrollPosition?, searchMode: Bool) -> Signal { return Signal { subscriber in let (deleteIndices, indicesAndItems, updateIndices) = mergeListsStableWithUpdates(leftList: fromView?.filteredEntries ?? [], rightList: toView.filteredEntries) @@ -183,9 +183,21 @@ func preparedChatListNodeViewTransition(from fromView: ChatListNodeView?, to toV } } - if let fromView = fromView, fromView.filteredEntries.isEmpty { - options.remove(.AnimateInsertion) - options.remove(.AnimateAlpha) + var fromEmptyView = false + if let fromView = fromView { + if fromView.filteredEntries.isEmpty { + options.remove(.AnimateInsertion) + options.remove(.AnimateAlpha) + fromEmptyView = true + } + } else { + fromEmptyView = true + } + + if !searchMode && fromEmptyView && scrollToItem == nil && toView.filteredEntries.count >= 2 { + if case .SearchEntry = toView.filteredEntries[toView.filteredEntries.count - 1] { + scrollToItem = ListViewScrollToItem(index: 1, position: .top(0.0), animated: false, curve: .Default(duration: 0.0), directionHint: .Up) + } } subscriber.putNext(ChatListNodeViewTransition(chatListView: toView, deleteItems: adjustedDeleteIndices, insertEntries: adjustedIndicesAndItems, updateEntries: adjustedUpdateItems, options: options, scrollToItem: scrollToItem, stationaryItemRange: stationaryItemRange)) diff --git a/TelegramUI/ChatMediaInputGifPane.swift b/TelegramUI/ChatMediaInputGifPane.swift index ba8e2e5fa0..4228ab9e7b 100644 --- a/TelegramUI/ChatMediaInputGifPane.swift +++ b/TelegramUI/ChatMediaInputGifPane.swift @@ -44,7 +44,7 @@ final class ChatMediaInputGifPane: ChatMediaInputPane, UIScrollViewDelegate { self.disposable.dispose() } - override func updateLayout(size: CGSize, topInset: CGFloat, bottomInset: CGFloat, isExpanded: Bool, transition: ContainedViewLayoutTransition) { + override func updateLayout(size: CGSize, topInset: CGFloat, bottomInset: CGFloat, isExpanded: Bool, isVisible: Bool, transition: ContainedViewLayoutTransition) { self.validLayout = size let emptySize = self.emptyNode.updateLayout(size) transition.updateFrame(node: self.emptyNode, frame: CGRect(origin: CGPoint(x: floor(size.width - emptySize.width) / 2.0, y: topInset + floor(size.height - topInset - emptySize.height) / 2.0), size: emptySize)) diff --git a/TelegramUI/ChatMediaInputMetaSectionItemNode.swift b/TelegramUI/ChatMediaInputMetaSectionItemNode.swift index 962ad8910d..d57e108fae 100644 --- a/TelegramUI/ChatMediaInputMetaSectionItemNode.swift +++ b/TelegramUI/ChatMediaInputMetaSectionItemNode.swift @@ -27,7 +27,7 @@ final class ChatMediaInputMetaSectionItem: ListViewItem { self.theme = theme } - func nodeConfiguredForParams(async: @escaping (@escaping () -> Void) -> Void, params: ListViewItemLayoutParams, synchronousLoads: Bool, previousItem: ListViewItem?, nextItem: ListViewItem?, completion: @escaping (ListViewItemNode, @escaping () -> (Signal?, () -> Void)) -> Void) { + func nodeConfiguredForParams(async: @escaping (@escaping () -> Void) -> Void, params: ListViewItemLayoutParams, synchronousLoads: Bool, previousItem: ListViewItem?, nextItem: ListViewItem?, completion: @escaping (ListViewItemNode, @escaping () -> (Signal?, (ListViewItemApply) -> Void)) -> Void) { async { let node = ChatMediaInputMetaSectionItemNode() node.contentSize = CGSize(width: 41.0, height: 41.0) @@ -39,7 +39,7 @@ final class ChatMediaInputMetaSectionItem: ListViewItem { node.updateAppearanceTransition(transition: .immediate) Queue.mainQueue().async { completion(node, { - return (nil, { + return (nil, { _ in }) }) @@ -47,9 +47,9 @@ final class ChatMediaInputMetaSectionItem: ListViewItem { } } - public func updateNode(async: @escaping (@escaping () -> Void) -> Void, node: @escaping () -> ListViewItemNode, params: ListViewItemLayoutParams, previousItem: ListViewItem?, nextItem: ListViewItem?, animation: ListViewItemUpdateAnimation, completion: @escaping (ListViewItemNodeLayout, @escaping () -> Void) -> Void) { + public func updateNode(async: @escaping (@escaping () -> Void) -> Void, node: @escaping () -> ListViewItemNode, params: ListViewItemLayoutParams, previousItem: ListViewItem?, nextItem: ListViewItem?, animation: ListViewItemUpdateAnimation, completion: @escaping (ListViewItemNodeLayout, @escaping (ListViewItemApply) -> Void) -> Void) { Queue.mainQueue().async { - completion(ListViewItemNodeLayout(contentSize: node().contentSize, insets: node().insets), { + completion(ListViewItemNodeLayout(contentSize: node().contentSize, insets: node().insets), { _ in (node() as? ChatMediaInputMetaSectionItemNode)?.setItem(item: self) (node() as? ChatMediaInputMetaSectionItemNode)?.updateTheme(theme: self.theme) }) diff --git a/TelegramUI/ChatMediaInputNode.swift b/TelegramUI/ChatMediaInputNode.swift index 8ef26f2f9c..fa1a417670 100644 --- a/TelegramUI/ChatMediaInputNode.swift +++ b/TelegramUI/ChatMediaInputNode.swift @@ -54,7 +54,7 @@ private func preparedChatMediaInputGridEntryTransition(account: Account, view: I case .search, .peerSpecificSetup: break case .sticker: - scrollToItem = GridNodeScrollToItem(index: i, position: .top, transition: .animated(duration: 0.0, curve: .easeInOut), directionHint: .down, adjustForSection: true, adjustForTopInset: true) + scrollToItem = GridNodeScrollToItem(index: i, position: .top, transition: .immediate, directionHint: .down, adjustForSection: true, adjustForTopInset: true) } } case .generic: @@ -394,6 +394,7 @@ final class ChatMediaInputNode: ChatInputNode { private let listView: ListView private var stickerSearchContainerNode: StickerPaneSearchContainerNode? + private let stickerSearchContainerNodeLoadedDisposable = MetaDisposable() private let stickerPane: ChatMediaInputStickerPane private var animatingStickerPaneOut = false @@ -409,7 +410,7 @@ final class ChatMediaInputNode: ChatInputNode { private var currentView: ItemCollectionsView? private let dismissedPeerSpecificStickerPack = Promise() - private var validLayout: (CGFloat, CGFloat, CGFloat, CGFloat, CGFloat, CGFloat, CGFloat, CGFloat, ChatPresentationInterfaceState)? + private var validLayout: (CGFloat, CGFloat, CGFloat, CGFloat, CGFloat, CGFloat, CGFloat, CGFloat, ChatPresentationInterfaceState, Bool)? private var paneArrangement: ChatMediaInputPaneArrangement private var initializedArrangement = false @@ -417,6 +418,12 @@ final class ChatMediaInputNode: ChatInputNode { private var strings: PresentationStrings private let themeAndStringsPromise: Promise<(PresentationTheme, PresentationStrings)> + private let _ready = Promise() + private var didSetReady = false + override var ready: Signal { + return self._ready.get() + } + init(account: Account, peerId: PeerId?, controllerInteraction: ChatControllerInteraction, theme: PresentationTheme, strings: PresentationStrings, gifPaneIsActiveUpdated: @escaping (Bool) -> Void) { self.account = account self.peerId = peerId @@ -504,16 +511,38 @@ final class ChatMediaInputNode: ChatInputNode { } }, toggleSearch: { [weak self] value in if let strongSelf = self { - strongSelf.controllerInteraction.updateInputMode { current in - switch current { - case let .media(mode, _): - if value { - return .media(mode: mode, expanded: .search) - } else { - return .media(mode: mode, expanded: nil) + if value { + let stickerSearchContainerNode: StickerPaneSearchContainerNode + if let current = strongSelf.stickerSearchContainerNode { + stickerSearchContainerNode = current + } else { + stickerSearchContainerNode = StickerPaneSearchContainerNode(account: strongSelf.account, theme: strongSelf.theme, strings: strongSelf.strings, controllerInteraction: strongSelf.controllerInteraction, inputNodeInteraction: strongSelf.inputNodeInteraction, cancel: { + self?.stickerSearchContainerNode?.deactivate() + self?.inputNodeInteraction.toggleSearch(false) + }) + strongSelf.stickerSearchContainerNode = stickerSearchContainerNode + } + strongSelf.stickerSearchContainerNodeLoadedDisposable.set((stickerSearchContainerNode.ready + |> deliverOnMainQueue).start(next: { + if let strongSelf = self { + strongSelf.controllerInteraction.updateInputMode { current in + switch current { + case let .media(mode, _): + return .media(mode: mode, expanded: .search) + default: + return current + } } - default: - return current + } + })) + } else { + strongSelf.controllerInteraction.updateInputMode { current in + switch current { + case let .media(mode, _): + return .media(mode: mode, expanded: nil) + default: + return current + } } } } @@ -728,6 +757,7 @@ final class ChatMediaInputNode: ChatInputNode { deinit { self.disposable.dispose() + self.stickerSearchContainerNodeLoadedDisposable.dispose() } private func updateThemeAndStrings(theme: PresentationTheme, strings: PresentationStrings) { @@ -920,8 +950,8 @@ final class ChatMediaInputNode: ChatInputNode { if let index = self.paneArrangement.panes.index(of: pane), index != self.paneArrangement.currentIndex { let previousGifPanelWasActive = self.paneArrangement.panes[self.paneArrangement.currentIndex] == .gifs self.paneArrangement = self.paneArrangement.withIndexTransition(0.0).withCurrentIndex(index) - if let (width, leftInset, rightInset, bottomInset, standardInputHeight, inputHeight, maximumHeight, inputPanelHeight, interfaceState) = self.validLayout { - let _ = self.updateLayout(width: width, leftInset: leftInset, rightInset: rightInset, bottomInset: bottomInset, standardInputHeight: standardInputHeight, inputHeight: inputHeight, maximumHeight: maximumHeight, inputPanelHeight: inputPanelHeight, transition: .animated(duration: 0.25, curve: .spring), interfaceState: interfaceState) + if let (width, leftInset, rightInset, bottomInset, standardInputHeight, inputHeight, maximumHeight, inputPanelHeight, interfaceState, isVisible) = self.validLayout { + let _ = self.updateLayout(width: width, leftInset: leftInset, rightInset: rightInset, bottomInset: bottomInset, standardInputHeight: standardInputHeight, inputHeight: inputHeight, maximumHeight: maximumHeight, inputPanelHeight: inputPanelHeight, transition: .animated(duration: 0.25, curve: .spring), interfaceState: interfaceState, isVisible: isVisible) self.updateAppearanceTransition(transition: transition) } let updatedGifPanelWasActive = self.paneArrangement.panes[self.paneArrangement.currentIndex] == .gifs @@ -941,8 +971,8 @@ final class ChatMediaInputNode: ChatInputNode { self.setHighlightedItemCollectionId(ItemCollectionId(namespace: ChatMediaInputPanelAuxiliaryNamespace.trending.rawValue, id: 0)) } } else { - if let (width, leftInset, rightInset, bottomInset, standardInputHeight, inputHeight, maximumHeight, inputPanelHeight, interfaceState) = self.validLayout { - let _ = self.updateLayout(width: width, leftInset: leftInset, rightInset: rightInset, bottomInset: bottomInset, standardInputHeight: standardInputHeight, inputHeight: inputHeight, maximumHeight: maximumHeight, inputPanelHeight: inputPanelHeight, transition: .animated(duration: 0.25, curve: .spring), interfaceState: interfaceState) + if let (width, leftInset, rightInset, bottomInset, standardInputHeight, inputHeight, maximumHeight, inputPanelHeight, interfaceState, isVisible) = self.validLayout { + let _ = self.updateLayout(width: width, leftInset: leftInset, rightInset: rightInset, bottomInset: bottomInset, standardInputHeight: standardInputHeight, inputHeight: inputHeight, maximumHeight: maximumHeight, inputPanelHeight: inputPanelHeight, transition: .animated(duration: 0.25, curve: .spring), interfaceState: interfaceState, isVisible: isVisible) } } } @@ -1070,8 +1100,8 @@ final class ChatMediaInputNode: ChatInputNode { } } - override func updateLayout(width: CGFloat, leftInset: CGFloat, rightInset: CGFloat, bottomInset: CGFloat, standardInputHeight: CGFloat, inputHeight: CGFloat, maximumHeight: CGFloat, inputPanelHeight: CGFloat, transition: ContainedViewLayoutTransition, interfaceState: ChatPresentationInterfaceState) -> (CGFloat, CGFloat) { - self.validLayout = (width, leftInset, rightInset, bottomInset, standardInputHeight, inputHeight, maximumHeight, inputPanelHeight, interfaceState) + override func updateLayout(width: CGFloat, leftInset: CGFloat, rightInset: CGFloat, bottomInset: CGFloat, standardInputHeight: CGFloat, inputHeight: CGFloat, maximumHeight: CGFloat, inputPanelHeight: CGFloat, transition: ContainedViewLayoutTransition, interfaceState: ChatPresentationInterfaceState, isVisible: Bool) -> (CGFloat, CGFloat) { + self.validLayout = (width, leftInset, rightInset, bottomInset, standardInputHeight, inputHeight, maximumHeight, inputPanelHeight, interfaceState, isVisible) if self.theme !== interfaceState.theme || self.strings !== interfaceState.strings { self.updateThemeAndStrings(theme: interfaceState.theme, strings: interfaceState.strings) @@ -1100,27 +1130,25 @@ final class ChatMediaInputNode: ChatInputNode { } if displaySearch { - let containerFrame = CGRect(origin: CGPoint(x: 0.0, y: -inputPanelHeight), size: CGSize(width: width, height: panelHeight + inputPanelHeight)) if let stickerSearchContainerNode = self.stickerSearchContainerNode { - transition.updateFrame(node: stickerSearchContainerNode, frame: containerFrame) - stickerSearchContainerNode.updateLayout(size: containerFrame.size, leftInset: leftInset, rightInset: rightInset, bottomInset: bottomInset, inputHeight: inputHeight, transition: transition) - } else { - let stickerSearchContainerNode = StickerPaneSearchContainerNode(account: self.account, theme: self.theme, strings: self.strings, controllerInteraction: self.controllerInteraction, inputNodeInteraction: self.inputNodeInteraction, cancel: { [weak self] in - self?.stickerSearchContainerNode?.deactivate() - self?.inputNodeInteraction.toggleSearch(false) - }) - self.stickerSearchContainerNode = stickerSearchContainerNode - self.insertSubnode(stickerSearchContainerNode, belowSubnode: self.collectionListContainer) - stickerSearchContainerNode.frame = containerFrame - stickerSearchContainerNode.updateLayout(size: containerFrame.size, leftInset: leftInset, rightInset: rightInset, bottomInset: bottomInset, inputHeight: inputHeight, transition: .immediate) - var placeholderNode: StickerPaneSearchBarPlaceholderNode? - self.stickerPane.gridNode.forEachItemNode { itemNode in - if let itemNode = itemNode as? StickerPaneSearchBarPlaceholderNode { - placeholderNode = itemNode + let containerFrame = CGRect(origin: CGPoint(x: 0.0, y: -inputPanelHeight), size: CGSize(width: width, height: panelHeight + inputPanelHeight)) + if stickerSearchContainerNode.supernode != nil { + transition.updateFrame(node: stickerSearchContainerNode, frame: containerFrame) + stickerSearchContainerNode.updateLayout(size: containerFrame.size, leftInset: leftInset, rightInset: rightInset, bottomInset: bottomInset, inputHeight: inputHeight, transition: transition) + } else { + self.stickerSearchContainerNode = stickerSearchContainerNode + self.insertSubnode(stickerSearchContainerNode, belowSubnode: self.collectionListContainer) + stickerSearchContainerNode.frame = containerFrame + stickerSearchContainerNode.updateLayout(size: containerFrame.size, leftInset: leftInset, rightInset: rightInset, bottomInset: bottomInset, inputHeight: inputHeight, transition: .immediate) + var placeholderNode: StickerPaneSearchBarPlaceholderNode? + self.stickerPane.gridNode.forEachItemNode { itemNode in + if let itemNode = itemNode as? StickerPaneSearchBarPlaceholderNode { + placeholderNode = itemNode + } + } + if let placeholderNode = placeholderNode { + stickerSearchContainerNode.animateIn(from: placeholderNode, transition: transition) } - } - if let placeholderNode = placeholderNode { - stickerSearchContainerNode.animateIn(from: placeholderNode, transition: transition) } } } @@ -1206,10 +1234,10 @@ final class ChatMediaInputNode: ChatInputNode { } } - self.gifPane.updateLayout(size: CGSize(width: width - leftInset - rightInset, height: panelHeight), topInset: 41.0, bottomInset: bottomInset, isExpanded: isExpanded, transition: transition) + self.gifPane.updateLayout(size: CGSize(width: width - leftInset - rightInset, height: panelHeight), topInset: 41.0, bottomInset: bottomInset, isExpanded: isExpanded, isVisible: isVisible, transition: transition) - self.stickerPane.updateLayout(size: CGSize(width: width - leftInset - rightInset, height: panelHeight), topInset: 41.0, bottomInset: bottomInset, isExpanded: isExpanded, transition: transition) - self.trendingPane.updateLayout(size: CGSize(width: width - leftInset - rightInset, height: panelHeight), topInset: 41.0, bottomInset: bottomInset, isExpanded: isExpanded, transition: transition) + self.stickerPane.updateLayout(size: CGSize(width: width - leftInset - rightInset, height: panelHeight), topInset: 41.0, bottomInset: bottomInset, isExpanded: isExpanded, isVisible: isVisible, transition: transition) + self.trendingPane.updateLayout(size: CGSize(width: width - leftInset - rightInset, height: panelHeight), topInset: 41.0, bottomInset: bottomInset, isExpanded: isExpanded, isVisible: isVisible, transition: transition) if self.gifPane.supernode != nil { if !visiblePanes.contains(where: { $0.0 == .gifs }) { @@ -1288,6 +1316,7 @@ final class ChatMediaInputNode: ChatInputNode { if !displaySearch, let stickerSearchContainerNode = self.stickerSearchContainerNode { self.stickerSearchContainerNode = nil + self.stickerSearchContainerNodeLoadedDisposable.set(nil) var placeholderNode: StickerPaneSearchBarPlaceholderNode? self.stickerPane.gridNode.forEachItemNode { itemNode in @@ -1322,6 +1351,10 @@ final class ChatMediaInputNode: ChatInputNode { self.listView.transaction(deleteIndices: transition.deletions, insertIndicesAndItems: transition.insertions, updateIndicesAndItems: transition.updates, options: options, updateOpaqueState: nil, completion: { [weak self] _ in if let strongSelf = self { strongSelf.enqueueGridTransition(gridTransition, firstTime: gridFirstTime) + if !strongSelf.didSetReady { + strongSelf.didSetReady = true + strongSelf._ready.set(.single(Void())) + } } }) } @@ -1368,7 +1401,7 @@ final class ChatMediaInputNode: ChatInputNode { self.trendingPane.removeFromSupernode() } case .changed: - if let (width, leftInset, rightInset, bottomInset, standardInputHeight, inputHeight, maximumHeight, inputPanelHeight, interfaceState) = self.validLayout { + if let (width, leftInset, rightInset, bottomInset, standardInputHeight, inputHeight, maximumHeight, inputPanelHeight, interfaceState, isVisible) = self.validLayout { let translationX = -recognizer.translation(in: self.view).x var indexTransition = translationX / width if self.paneArrangement.currentIndex == 0 { @@ -1377,10 +1410,10 @@ final class ChatMediaInputNode: ChatInputNode { indexTransition = min(0.0, indexTransition) } self.paneArrangement = self.paneArrangement.withIndexTransition(indexTransition) - let _ = self.updateLayout(width: width, leftInset: leftInset, rightInset: rightInset, bottomInset: bottomInset, standardInputHeight: standardInputHeight, inputHeight: inputHeight, maximumHeight: maximumHeight, inputPanelHeight: inputPanelHeight, transition: .immediate, interfaceState: interfaceState) + let _ = self.updateLayout(width: width, leftInset: leftInset, rightInset: rightInset, bottomInset: bottomInset, standardInputHeight: standardInputHeight, inputHeight: inputHeight, maximumHeight: maximumHeight, inputPanelHeight: inputPanelHeight, transition: .immediate, interfaceState: interfaceState, isVisible: isVisible) } case .ended: - if let (width, _, _, _, _, _, _, _, _) = self.validLayout { + if let (width, _, _, _, _, _, _, _, _, _) = self.validLayout { var updatedIndex = self.paneArrangement.currentIndex if abs(self.paneArrangement.indexTransition * width) > 30.0 { if self.paneArrangement.indexTransition < 0.0 { @@ -1393,9 +1426,9 @@ final class ChatMediaInputNode: ChatInputNode { self.setCurrentPane(self.paneArrangement.panes[updatedIndex], transition: .animated(duration: 0.25, curve: .spring)) } case .cancelled: - if let (width, leftInset, rightInset, bottomInset, standardInputHeight, inputHeight, maximumHeight, inputPanelHeight, interfaceState) = self.validLayout { + if let (width, leftInset, rightInset, bottomInset, standardInputHeight, inputHeight, maximumHeight, inputPanelHeight, interfaceState, isVisible) = self.validLayout { self.paneArrangement = self.paneArrangement.withIndexTransition(0.0) - let _ = self.updateLayout(width: width, leftInset: leftInset, rightInset: rightInset, bottomInset: bottomInset, standardInputHeight: standardInputHeight, inputHeight: inputHeight, maximumHeight: maximumHeight, inputPanelHeight: inputPanelHeight, transition: .animated(duration: 0.25, curve: .spring), interfaceState: interfaceState) + let _ = self.updateLayout(width: width, leftInset: leftInset, rightInset: rightInset, bottomInset: bottomInset, standardInputHeight: standardInputHeight, inputHeight: inputHeight, maximumHeight: maximumHeight, inputPanelHeight: inputPanelHeight, transition: .animated(duration: 0.25, curve: .spring), interfaceState: interfaceState, isVisible: isVisible) } default: break diff --git a/TelegramUI/ChatMediaInputPane.swift b/TelegramUI/ChatMediaInputPane.swift index 6fe5c6cf74..e45b0e7ce3 100644 --- a/TelegramUI/ChatMediaInputPane.swift +++ b/TelegramUI/ChatMediaInputPane.swift @@ -10,6 +10,6 @@ struct ChatMediaInputPaneScrollState { class ChatMediaInputPane: ASDisplayNode { var collectionListPanelOffset: CGFloat = 0.0 - func updateLayout(size: CGSize, topInset: CGFloat, bottomInset: CGFloat, isExpanded: Bool, transition: ContainedViewLayoutTransition) { + func updateLayout(size: CGSize, topInset: CGFloat, bottomInset: CGFloat, isExpanded: Bool, isVisible: Bool, transition: ContainedViewLayoutTransition) { } } diff --git a/TelegramUI/ChatMediaInputPeerSpecificItem.swift b/TelegramUI/ChatMediaInputPeerSpecificItem.swift index aa055998d9..cc8e9730d1 100644 --- a/TelegramUI/ChatMediaInputPeerSpecificItem.swift +++ b/TelegramUI/ChatMediaInputPeerSpecificItem.swift @@ -26,7 +26,7 @@ final class ChatMediaInputPeerSpecificItem: ListViewItem { self.theme = theme } - func nodeConfiguredForParams(async: @escaping (@escaping () -> Void) -> Void, params: ListViewItemLayoutParams, synchronousLoads: Bool, previousItem: ListViewItem?, nextItem: ListViewItem?, completion: @escaping (ListViewItemNode, @escaping () -> (Signal?, () -> Void)) -> Void) { + func nodeConfiguredForParams(async: @escaping (@escaping () -> Void) -> Void, params: ListViewItemLayoutParams, synchronousLoads: Bool, previousItem: ListViewItem?, nextItem: ListViewItem?, completion: @escaping (ListViewItemNode, @escaping () -> (Signal?, (ListViewItemApply) -> Void)) -> Void) { async { let node = ChatMediaInputPeerSpecificItemNode() node.contentSize = boundingSize @@ -34,7 +34,7 @@ final class ChatMediaInputPeerSpecificItem: ListViewItem { node.inputNodeInteraction = self.inputNodeInteraction Queue.mainQueue().async { completion(node, { - return (nil, { + return (nil, { _ in node.updateItem(account: self.account, peer: self.peer, collectionId: self.collectionId, theme: self.theme) node.updateAppearanceTransition(transition: .immediate) }) @@ -43,9 +43,9 @@ final class ChatMediaInputPeerSpecificItem: ListViewItem { } } - public func updateNode(async: @escaping (@escaping () -> Void) -> Void, node: @escaping () -> ListViewItemNode, params: ListViewItemLayoutParams, previousItem: ListViewItem?, nextItem: ListViewItem?, animation: ListViewItemUpdateAnimation, completion: @escaping (ListViewItemNodeLayout, @escaping () -> Void) -> Void) { + public func updateNode(async: @escaping (@escaping () -> Void) -> Void, node: @escaping () -> ListViewItemNode, params: ListViewItemLayoutParams, previousItem: ListViewItem?, nextItem: ListViewItem?, animation: ListViewItemUpdateAnimation, completion: @escaping (ListViewItemNodeLayout, @escaping (ListViewItemApply) -> Void) -> Void) { Queue.mainQueue().async { - completion(ListViewItemNodeLayout(contentSize: node().contentSize, insets: ChatMediaInputNode.setupPanelIconInsets(item: self, previousItem: previousItem, nextItem: nextItem)), { + completion(ListViewItemNodeLayout(contentSize: node().contentSize, insets: ChatMediaInputNode.setupPanelIconInsets(item: self, previousItem: previousItem, nextItem: nextItem)), { _ in (node() as? ChatMediaInputPeerSpecificItemNode)?.updateItem(account: self.account, peer: self.peer, collectionId: self.collectionId, theme: self.theme) }) } diff --git a/TelegramUI/ChatMediaInputRecentGifsItem.swift b/TelegramUI/ChatMediaInputRecentGifsItem.swift index 06e0e46ecb..e6c7d35b18 100644 --- a/TelegramUI/ChatMediaInputRecentGifsItem.swift +++ b/TelegramUI/ChatMediaInputRecentGifsItem.swift @@ -20,7 +20,7 @@ final class ChatMediaInputRecentGifsItem: ListViewItem { self.theme = theme } - func nodeConfiguredForParams(async: @escaping (@escaping () -> Void) -> Void, params: ListViewItemLayoutParams, synchronousLoads: Bool, previousItem: ListViewItem?, nextItem: ListViewItem?, completion: @escaping (ListViewItemNode, @escaping () -> (Signal?, () -> Void)) -> Void) { + func nodeConfiguredForParams(async: @escaping (@escaping () -> Void) -> Void, params: ListViewItemLayoutParams, synchronousLoads: Bool, previousItem: ListViewItem?, nextItem: ListViewItem?, completion: @escaping (ListViewItemNode, @escaping () -> (Signal?, (ListViewItemApply) -> Void)) -> Void) { async { let node = ChatMediaInputRecentGifsItemNode() node.contentSize = CGSize(width: 41.0, height: 41.0) @@ -31,15 +31,15 @@ final class ChatMediaInputRecentGifsItem: ListViewItem { node.updateAppearanceTransition(transition: .immediate) Queue.mainQueue().async { completion(node, { - return (nil, {}) + return (nil, { _ in }) }) } } } - public func updateNode(async: @escaping (@escaping () -> Void) -> Void, node: @escaping () -> ListViewItemNode, params: ListViewItemLayoutParams, previousItem: ListViewItem?, nextItem: ListViewItem?, animation: ListViewItemUpdateAnimation, completion: @escaping (ListViewItemNodeLayout, @escaping () -> Void) -> Void) { + public func updateNode(async: @escaping (@escaping () -> Void) -> Void, node: @escaping () -> ListViewItemNode, params: ListViewItemLayoutParams, previousItem: ListViewItem?, nextItem: ListViewItem?, animation: ListViewItemUpdateAnimation, completion: @escaping (ListViewItemNodeLayout, @escaping (ListViewItemApply) -> Void) -> Void) { Queue.mainQueue().async { - completion(ListViewItemNodeLayout(contentSize: node().contentSize, insets: ChatMediaInputNode.setupPanelIconInsets(item: self, previousItem: previousItem, nextItem: nextItem)), { + completion(ListViewItemNodeLayout(contentSize: node().contentSize, insets: ChatMediaInputNode.setupPanelIconInsets(item: self, previousItem: previousItem, nextItem: nextItem)), { _ in (node() as? ChatMediaInputRecentGifsItemNode)?.updateTheme(theme: self.theme) }) } diff --git a/TelegramUI/ChatMediaInputSettingsItem.swift b/TelegramUI/ChatMediaInputSettingsItem.swift index 1eaaa108f3..f7b1fb3a00 100644 --- a/TelegramUI/ChatMediaInputSettingsItem.swift +++ b/TelegramUI/ChatMediaInputSettingsItem.swift @@ -20,7 +20,7 @@ final class ChatMediaInputSettingsItem: ListViewItem { self.theme = theme } - func nodeConfiguredForParams(async: @escaping (@escaping () -> Void) -> Void, params: ListViewItemLayoutParams, synchronousLoads: Bool, previousItem: ListViewItem?, nextItem: ListViewItem?, completion: @escaping (ListViewItemNode, @escaping () -> (Signal?, () -> Void)) -> Void) { + func nodeConfiguredForParams(async: @escaping (@escaping () -> Void) -> Void, params: ListViewItemLayoutParams, synchronousLoads: Bool, previousItem: ListViewItem?, nextItem: ListViewItem?, completion: @escaping (ListViewItemNode, @escaping () -> (Signal?, (ListViewItemApply) -> Void)) -> Void) { async { let node = ChatMediaInputSettingsItemNode() node.contentSize = CGSize(width: 41.0, height: 41.0) @@ -30,15 +30,15 @@ final class ChatMediaInputSettingsItem: ListViewItem { node.updateAppearanceTransition(transition: .immediate) Queue.mainQueue().async { completion(node, { - return (nil, {}) + return (nil, { _ in }) }) } } } - public func updateNode(async: @escaping (@escaping () -> Void) -> Void, node: @escaping () -> ListViewItemNode, params: ListViewItemLayoutParams, previousItem: ListViewItem?, nextItem: ListViewItem?, animation: ListViewItemUpdateAnimation, completion: @escaping (ListViewItemNodeLayout, @escaping () -> Void) -> Void) { + public func updateNode(async: @escaping (@escaping () -> Void) -> Void, node: @escaping () -> ListViewItemNode, params: ListViewItemLayoutParams, previousItem: ListViewItem?, nextItem: ListViewItem?, animation: ListViewItemUpdateAnimation, completion: @escaping (ListViewItemNodeLayout, @escaping (ListViewItemApply) -> Void) -> Void) { Queue.mainQueue().async { - completion(ListViewItemNodeLayout(contentSize: node().contentSize, insets: ChatMediaInputNode.setupPanelIconInsets(item: self, previousItem: previousItem, nextItem: nextItem)), { + completion(ListViewItemNodeLayout(contentSize: node().contentSize, insets: ChatMediaInputNode.setupPanelIconInsets(item: self, previousItem: previousItem, nextItem: nextItem)), { _ in (node() as? ChatMediaInputSettingsItemNode)?.updateTheme(theme: self.theme) }) } diff --git a/TelegramUI/ChatMediaInputStickerGridItem.swift b/TelegramUI/ChatMediaInputStickerGridItem.swift index 82e452a79e..a5d54411c0 100644 --- a/TelegramUI/ChatMediaInputStickerGridItem.swift +++ b/TelegramUI/ChatMediaInputStickerGridItem.swift @@ -134,6 +134,7 @@ final class ChatMediaInputStickerGridItem: GridItem { final class ChatMediaInputStickerGridItemNode: GridItemNode { private var currentState: (Account, StickerPackItem, CGSize)? + private var currentSize: CGSize? private let imageNode: TransformImageNode private let stickerFetchedDisposable = MetaDisposable() @@ -167,31 +168,35 @@ final class ChatMediaInputStickerGridItemNode: GridItemNode { } func setup(account: Account, stickerItem: StickerPackItem) { - if self.currentState == nil || self.currentState!.0 !== account || self.currentState!.1 != stickerItem { - if let dimensions = stickerItem.file.dimensions { - self.imageNode.setSignal(chatMessageSticker(account: account, file: stickerItem.file, small: true)) - self.stickerFetchedDisposable.set(freeMediaFileResourceInteractiveFetched(account: account, fileReference: stickerPackFileReference(stickerItem.file), resource: chatMessageStickerResource(file: stickerItem.file, small: true)).start()) - - self.currentState = (account, stickerItem, dimensions) - self.setNeedsLayout() - } - } - //self.updateSelectionState(animated: false) //self.updateHiddenMedia() } - override func layout() { - super.layout() + override func updateLayout(item: GridItem, size: CGSize, isVisible: Bool, synchronousLoads: Bool) { + guard let item = item as? ChatMediaInputStickerGridItem else { + return + } + if self.currentState == nil || self.currentState!.0 !== item.account || self.currentState!.1 != item.stickerItem { + if let dimensions = item.stickerItem.file.dimensions { + self.imageNode.setSignal(chatMessageSticker(account: item.account, file: item.stickerItem.file, small: true, synchronousLoad: synchronousLoads && isVisible)) + self.stickerFetchedDisposable.set(freeMediaFileResourceInteractiveFetched(account: item.account, fileReference: stickerPackFileReference(item.stickerItem.file), resource: chatMessageStickerResource(file: item.stickerItem.file, small: true)).start()) + + self.currentState = (item.account, item.stickerItem, dimensions) + self.setNeedsLayout() + } + } - let bounds = self.bounds - let sideSize: CGFloat = min(75.0 - 10.0, bounds.width) - let boundingSize = CGSize(width: sideSize, height: sideSize) - - if let (_, _, mediaDimensions) = self.currentState { - let imageSize = mediaDimensions.aspectFitted(boundingSize) - self.imageNode.asyncLayout()(TransformImageArguments(corners: ImageCorners(), imageSize: imageSize, boundingSize: imageSize, intrinsicInsets: UIEdgeInsets()))() - self.imageNode.frame = CGRect(origin: CGPoint(x: floor((bounds.size.width - imageSize.width) / 2.0), y: (bounds.size.height - imageSize.height) / 2.0), size: imageSize) + if self.currentSize != size { + self.currentSize = size + + let sideSize: CGFloat = min(75.0 - 10.0, size.width) + let boundingSize = CGSize(width: sideSize, height: sideSize) + + if let (_, _, mediaDimensions) = self.currentState { + let imageSize = mediaDimensions.aspectFitted(boundingSize) + self.imageNode.asyncLayout()(TransformImageArguments(corners: ImageCorners(), imageSize: imageSize, boundingSize: imageSize, intrinsicInsets: UIEdgeInsets()))() + self.imageNode.frame = CGRect(origin: CGPoint(x: floor((size.width - imageSize.width) / 2.0), y: (size.height - imageSize.height) / 2.0), size: imageSize) + } } } diff --git a/TelegramUI/ChatMediaInputStickerPackItem.swift b/TelegramUI/ChatMediaInputStickerPackItem.swift index a3bec90ce6..4b73a92ad4 100644 --- a/TelegramUI/ChatMediaInputStickerPackItem.swift +++ b/TelegramUI/ChatMediaInputStickerPackItem.swift @@ -28,7 +28,7 @@ final class ChatMediaInputStickerPackItem: ListViewItem { self.theme = theme } - func nodeConfiguredForParams(async: @escaping (@escaping () -> Void) -> Void, params: ListViewItemLayoutParams, synchronousLoads: Bool, previousItem: ListViewItem?, nextItem: ListViewItem?, completion: @escaping (ListViewItemNode, @escaping () -> (Signal?, () -> Void)) -> Void) { + func nodeConfiguredForParams(async: @escaping (@escaping () -> Void) -> Void, params: ListViewItemLayoutParams, synchronousLoads: Bool, previousItem: ListViewItem?, nextItem: ListViewItem?, completion: @escaping (ListViewItemNode, @escaping () -> (Signal?, (ListViewItemApply) -> Void)) -> Void) { async { let node = ChatMediaInputStickerPackItemNode() node.contentSize = boundingSize @@ -36,7 +36,7 @@ final class ChatMediaInputStickerPackItem: ListViewItem { node.inputNodeInteraction = self.inputNodeInteraction Queue.mainQueue().async { completion(node, { - return (nil, { + return (nil, { _ in node.updateStickerPackItem(account: self.account, item: self.stickerPackItem, collectionId: self.collectionId, theme: self.theme) node.updateAppearanceTransition(transition: .immediate) }) @@ -45,9 +45,9 @@ final class ChatMediaInputStickerPackItem: ListViewItem { } } - public func updateNode(async: @escaping (@escaping () -> Void) -> Void, node: @escaping () -> ListViewItemNode, params: ListViewItemLayoutParams, previousItem: ListViewItem?, nextItem: ListViewItem?, animation: ListViewItemUpdateAnimation, completion: @escaping (ListViewItemNodeLayout, @escaping () -> Void) -> Void) { + public func updateNode(async: @escaping (@escaping () -> Void) -> Void, node: @escaping () -> ListViewItemNode, params: ListViewItemLayoutParams, previousItem: ListViewItem?, nextItem: ListViewItem?, animation: ListViewItemUpdateAnimation, completion: @escaping (ListViewItemNodeLayout, @escaping (ListViewItemApply) -> Void) -> Void) { Queue.mainQueue().async { - completion(ListViewItemNodeLayout(contentSize: node().contentSize, insets: ChatMediaInputNode.setupPanelIconInsets(item: self, previousItem: previousItem, nextItem: nextItem)), { + completion(ListViewItemNodeLayout(contentSize: node().contentSize, insets: ChatMediaInputNode.setupPanelIconInsets(item: self, previousItem: previousItem, nextItem: nextItem)), { _ in (node() as? ChatMediaInputStickerPackItemNode)?.updateStickerPackItem(account: self.account, item: self.stickerPackItem, collectionId: self.collectionId, theme: self.theme) }) } diff --git a/TelegramUI/ChatMediaInputStickerPane.swift b/TelegramUI/ChatMediaInputStickerPane.swift index 20f32f952c..280acfc51b 100644 --- a/TelegramUI/ChatMediaInputStickerPane.swift +++ b/TelegramUI/ChatMediaInputStickerPane.swift @@ -15,6 +15,7 @@ final class ChatMediaInputStickerPaneOpaqueState { final class ChatMediaInputStickerPane: ChatMediaInputPane { private var isExpanded: Bool? + private var isPaneVisible = false let gridNode: GridNode private let paneDidScroll: (ChatMediaInputPane, ChatMediaInputPaneScrollState, ContainedViewLayoutTransition) -> Void private let fixPaneScroll: (ChatMediaInputPane, ChatMediaInputPaneScrollState) -> Void @@ -58,7 +59,7 @@ final class ChatMediaInputStickerPane: ChatMediaInputPane { self.gridNode.scrollView.alwaysBounceVertical = true } - override func updateLayout(size: CGSize, topInset: CGFloat, bottomInset: CGFloat, isExpanded: Bool, transition: ContainedViewLayoutTransition) { + override func updateLayout(size: CGSize, topInset: CGFloat, bottomInset: CGFloat, isExpanded: Bool, isVisible: Bool, transition: ContainedViewLayoutTransition) { var changedIsExpanded = false if let previousIsExpanded = self.isExpanded { if previousIsExpanded != isExpanded { @@ -70,7 +71,7 @@ final class ChatMediaInputStickerPane: ChatMediaInputPane { let sideInset: CGFloat = 2.0 var itemSide: CGFloat = floor((size.width - sideInset * 2.0) / 5.0) itemSide = min(itemSide, 75.0) - let itemSize = CGSize(width: itemSide, height: itemSide) + let itemSize = CGSize(width: itemSide, height: max(itemSide, 80.0)) var scrollToItem: GridNodeScrollToItem? if changedIsExpanded { @@ -98,13 +99,23 @@ final class ChatMediaInputStickerPane: ChatMediaInputPane { } } } - self.gridNode.transaction(GridNodeTransaction(deleteItems: [], insertItems: [], updateItems: [], scrollToItem: scrollToItem, updateLayout: GridNodeUpdateLayout(layout: GridNodeLayout(size: size, insets: UIEdgeInsets(top: topInset, left: sideInset, bottom: bottomInset, right: sideInset), preloadSize: 300.0, type: .fixed(itemSize: itemSize, fillWidth: nil, lineSpacing: 0.0, itemSpacing: nil)), transition: transition), itemTransition: .immediate, stationaryItems: .none, updateFirstIndexInSectionOffset: nil), completion: { _ in }) + self.gridNode.transaction(GridNodeTransaction(deleteItems: [], insertItems: [], updateItems: [], scrollToItem: scrollToItem, updateLayout: GridNodeUpdateLayout(layout: GridNodeLayout(size: size, insets: UIEdgeInsets(top: topInset, left: sideInset, bottom: bottomInset, right: sideInset), preloadSize: isVisible ? 300.0 : 0.0, type: .fixed(itemSize: itemSize, fillWidth: nil, lineSpacing: 0.0, itemSpacing: nil)), transition: transition), itemTransition: .immediate, stationaryItems: .none, updateFirstIndexInSectionOffset: nil), completion: { _ in }) if false, let scrollToItem = scrollToItem { self.gridNode.transaction(GridNodeTransaction(deleteItems: [], insertItems: [], updateItems: [], scrollToItem: scrollToItem, updateLayout: nil, itemTransition: .immediate, stationaryItems: .none, updateFirstIndexInSectionOffset: nil), completion: { _ in }) } transition.updateFrame(node: self.gridNode, frame: CGRect(origin: CGPoint(), size: CGSize(width: size.width, height: size.height))) + + if self.isPaneVisible != isVisible { + self.isPaneVisible = isVisible + if isVisible { + self.gridNode.forEachItemNode { itemNode in + if let _ = itemNode as? ChatMediaInputStickerGridItemNode { + } + } + } + } } func itemAt(point: CGPoint) -> (ASDisplayNode, StickerPackItem)? { diff --git a/TelegramUI/ChatMediaInputTrendingItem.swift b/TelegramUI/ChatMediaInputTrendingItem.swift index b3f9d1e217..70e1186c6e 100644 --- a/TelegramUI/ChatMediaInputTrendingItem.swift +++ b/TelegramUI/ChatMediaInputTrendingItem.swift @@ -20,7 +20,7 @@ final class ChatMediaInputTrendingItem: ListViewItem { self.theme = theme } - func nodeConfiguredForParams(async: @escaping (@escaping () -> Void) -> Void, params: ListViewItemLayoutParams, synchronousLoads: Bool, previousItem: ListViewItem?, nextItem: ListViewItem?, completion: @escaping (ListViewItemNode, @escaping () -> (Signal?, () -> Void)) -> Void) { + func nodeConfiguredForParams(async: @escaping (@escaping () -> Void) -> Void, params: ListViewItemLayoutParams, synchronousLoads: Bool, previousItem: ListViewItem?, nextItem: ListViewItem?, completion: @escaping (ListViewItemNode, @escaping () -> (Signal?, (ListViewItemApply) -> Void)) -> Void) { async { let node = ChatMediaInputTrendingItemNode() node.contentSize = CGSize(width: 41.0, height: 41.0) @@ -31,15 +31,15 @@ final class ChatMediaInputTrendingItem: ListViewItem { node.updateAppearanceTransition(transition: .immediate) Queue.mainQueue().async { completion(node, { - return (nil, {}) + return (nil, { _ in }) }) } } } - public func updateNode(async: @escaping (@escaping () -> Void) -> Void, node: @escaping () -> ListViewItemNode, params: ListViewItemLayoutParams, previousItem: ListViewItem?, nextItem: ListViewItem?, animation: ListViewItemUpdateAnimation, completion: @escaping (ListViewItemNodeLayout, @escaping () -> Void) -> Void) { + public func updateNode(async: @escaping (@escaping () -> Void) -> Void, node: @escaping () -> ListViewItemNode, params: ListViewItemLayoutParams, previousItem: ListViewItem?, nextItem: ListViewItem?, animation: ListViewItemUpdateAnimation, completion: @escaping (ListViewItemNodeLayout, @escaping (ListViewItemApply) -> Void) -> Void) { Queue.mainQueue().async { - completion(ListViewItemNodeLayout(contentSize: node().contentSize, insets: ChatMediaInputNode.setupPanelIconInsets(item: self, previousItem: previousItem, nextItem: nextItem)), { + completion(ListViewItemNodeLayout(contentSize: node().contentSize, insets: ChatMediaInputNode.setupPanelIconInsets(item: self, previousItem: previousItem, nextItem: nextItem)), { _ in (node() as? ChatMediaInputTrendingItemNode)?.updateTheme(theme: self.theme) }) } diff --git a/TelegramUI/ChatMediaInputTrendingPane.swift b/TelegramUI/ChatMediaInputTrendingPane.swift index 2f0ec5e611..fe2c043d21 100644 --- a/TelegramUI/ChatMediaInputTrendingPane.swift +++ b/TelegramUI/ChatMediaInputTrendingPane.swift @@ -103,6 +103,12 @@ final class ChatMediaInputTrendingPane: ChatMediaInputPane { private var disposable: Disposable? private var isActivated = false + private let _ready = Promise() + private var didSetReady = false + var ready: Signal { + return self._ready.get() + } + var scrollingInitiated: (() -> Void)? init(account: Account, controllerInteraction: ChatControllerInteraction, getItemIsPreviewed: @escaping (StickerPackItem) -> Bool) { @@ -189,11 +195,18 @@ final class ChatMediaInputTrendingPane: ChatMediaInputPane { return preparedTransition(from: previous ?? [], to: entries, account: account, theme: presentationData.theme, strings: presentationData.strings, interaction: interaction, initial: previous == nil) } |> deliverOnMainQueue).start(next: { [weak self] transition in - self?.enqueueTransition(transition) + guard let strongSelf = self else { + return + } + strongSelf.enqueueTransition(transition) + if !strongSelf.didSetReady { + strongSelf.didSetReady = true + strongSelf._ready.set(.single(Void())) + } }) } - override func updateLayout(size: CGSize, topInset: CGFloat, bottomInset: CGFloat, isExpanded: Bool, transition: ContainedViewLayoutTransition) { + override func updateLayout(size: CGSize, topInset: CGFloat, bottomInset: CGFloat, isExpanded: Bool, isVisible: Bool, transition: ContainedViewLayoutTransition) { let hadValidLayout = self.validLayout != nil self.validLayout = (size, bottomInset) @@ -224,7 +237,7 @@ final class ChatMediaInputTrendingPane: ChatMediaInputPane { } private func enqueueTransition(_ transition: TrendingPaneTransition) { - enqueuedTransitions.append(transition) + self.enqueuedTransitions.append(transition) if self.validLayout != nil { while !self.enqueuedTransitions.isEmpty { @@ -245,8 +258,9 @@ final class ChatMediaInputTrendingPane: ChatMediaInputPane { var options = ListViewDeleteAndInsertOptions() if transition.initial { - //options.insert(.Synchronous) - //options.insert(.LowLatency) + options.insert(.Synchronous) + options.insert(.LowLatency) + options.insert(.PreferSynchronousResourceLoading) } else { options.insert(.AnimateInsertion) } diff --git a/TelegramUI/ChatMessageAnimatedStickerItemNode.swift b/TelegramUI/ChatMessageAnimatedStickerItemNode.swift new file mode 100644 index 0000000000..c19eb03d22 --- /dev/null +++ b/TelegramUI/ChatMessageAnimatedStickerItemNode.swift @@ -0,0 +1,652 @@ +import Foundation +import AsyncDisplayKit +import Display +import SwiftSignalKit +import Postbox +import TelegramCore +import Lottie + +private final class StickerAnimationNode : ASDisplayNode { + private var disposable = MetaDisposable() + var loopCount: Int = 0 + + override init() { + super.init() + + self.setViewBlock({ + let view = LOTAnimationView() + return view + }) + } + + deinit { + self.disposable.dispose() + } + + func setSignal(_ signal: Signal) { + self.disposable.set((signal |> deliverOnMainQueue).start(next: { [weak self] next in + if let object = try? JSONSerialization.jsonObject(with: next, options: []) as? [AnyHashable: Any], let json = object { + self?.animationView()?.setAnimation(json: json) + } + })) + } + + func animationView() -> LOTAnimationView? { + return self.view as? LOTAnimationView + } + + func play() { + DispatchQueue.main.async { + if let animationView = self.animationView(), !animationView.isAnimationPlaying { + self.loopCount = 2 + + var completion: ((Bool) -> Void)! + let placeholder: (Bool) -> Void = { [weak animationView] _ in + self.loopCount -= 1 + if self.loopCount > 0 { + animationView?.play(completion: completion) + } + } + completion = placeholder + + if !animationView.isAnimationPlaying { + animationView.play(completion: completion) + } + } + } + } + + func reset() { + DispatchQueue.main.async { + if let animationView = self.animationView() { + animationView.stop() + } + } + } +} + +class ChatMessageAnimatedStickerItemNode: ChatMessageItemView { + let imageNode: TransformImageNode + private let animationNode: StickerAnimationNode + var progressNode: RadialProgressNode? + + private var swipeToReplyNode: ChatMessageSwipeToReplyNode? + private var swipeToReplyFeedback: HapticFeedback? + + private var selectionNode: ChatMessageSelectionNode? + private var shareButtonNode: HighlightableButtonNode? + + var telegramFile: TelegramMediaFile? + + private let fetchDisposable = MetaDisposable() + + private let dateAndStatusNode: ChatMessageDateAndStatusNode + private var replyInfoNode: ChatMessageReplyInfoNode? + private var replyBackgroundNode: ASImageNode? + + private var highlightedState: Bool = false + + private var currentSwipeToReplyTranslation: CGFloat = 0.0 + + required init() { + self.imageNode = TransformImageNode() + self.animationNode = StickerAnimationNode() + self.dateAndStatusNode = ChatMessageDateAndStatusNode() + + super.init(layerBacked: false) + + self.imageNode.displaysAsynchronously = false + self.addSubnode(self.imageNode) + self.addSubnode(self.animationNode) + self.addSubnode(self.dateAndStatusNode) + } + + required init?(coder aDecoder: NSCoder) { + fatalError("init(coder:) has not been implemented") + } + + deinit { + self.fetchDisposable.dispose() + } + + override func didLoad() { + super.didLoad() + + let recognizer = TapLongTapOrDoubleTapGestureRecognizer(target: self, action: #selector(self.tapLongTapOrDoubleTapGesture(_:))) + recognizer.tapActionAtPoint = { [weak self] point in + if let strongSelf = self { + if let shareButtonNode = strongSelf.shareButtonNode, shareButtonNode.frame.contains(point) { + return .fail + } + } + return .waitForSingleTap + } + self.view.addGestureRecognizer(recognizer) + + let replyRecognizer = ChatSwipeToReplyRecognizer(target: self, action: #selector(self.swipeToReplyGesture(_:))) + replyRecognizer.shouldBegin = { [weak self] in + if let strongSelf = self, let item = strongSelf.item { + if strongSelf.selectionNode != nil { + return false + } + return item.controllerInteraction.canSetupReply(item.message) + } + return false + } + self.view.addGestureRecognizer(replyRecognizer) + } + + override func setupItem(_ item: ChatMessageItem) { + super.setupItem(item) + + for media in item.message.media { + if let telegramFile = media as? TelegramMediaFile { + if self.telegramFile != telegramFile { + let signal = chatMessageAnimatedStickerDatas(postbox: item.account.postbox, fileReference: FileMediaReference.message(message: MessageReference(item.message), media: telegramFile), synchronousLoad: false) + |> mapToSignal { data, completed -> Signal in + if completed, let data = data { + return .single(data) + } else { + return .complete() + } + } + self.telegramFile = telegramFile + self.animationNode.setSignal(signal) + self.fetchDisposable.set(freeMediaFileInteractiveFetched(account: item.account, fileReference: .message(message: MessageReference(item.message), media: telegramFile)).start()) + + self.animationNode.play() + } + + break + } + } + } + + override func asyncLayout() -> (_ item: ChatMessageItem, _ params: ListViewItemLayoutParams, _ mergedTop: ChatMessageMerge, _ mergedBottom: ChatMessageMerge, _ dateHeaderAtBottom: Bool) -> (ListViewItemNodeLayout, (ListViewItemUpdateAnimation, Bool) -> Void) { + let displaySize = CGSize(width: 162.0, height: 162.0) + let telegramFile = self.telegramFile + let layoutConstants = self.layoutConstants + let imageLayout = self.imageNode.asyncLayout() + let makeDateAndStatusLayout = self.dateAndStatusNode.asyncLayout() + + let makeReplyInfoLayout = ChatMessageReplyInfoNode.asyncLayout(self.replyInfoNode) + let currentReplyBackgroundNode = self.replyBackgroundNode + let currentShareButtonNode = self.shareButtonNode + let currentItem = self.item + + return { item, params, mergedTop, mergedBottom, dateHeaderAtBottom in + let incoming = item.message.effectivelyIncoming(item.account.peerId) + var imageSize: CGSize = CGSize(width: 162.0, height: 162.0) + if let telegramFile = telegramFile { + if let dimensions = telegramFile.dimensions { + imageSize = dimensions.aspectFitted(displaySize) + } else if let thumbnailSize = telegramFile.previewRepresentations.first?.dimensions { + imageSize = thumbnailSize.aspectFitted(displaySize) + } + } + + let avatarInset: CGFloat + var hasAvatar = false + + switch item.chatLocation { + case let .peer(peerId): + if peerId != item.account.peerId { + if peerId.isGroupOrChannel && item.message.author != nil { + var isBroadcastChannel = false + if let peer = item.message.peers[item.message.id.peerId] as? TelegramChannel, case .broadcast = peer.info { + isBroadcastChannel = true + } + + if !isBroadcastChannel { + hasAvatar = true + } + } + } else if incoming { + hasAvatar = true + } + case .group: + hasAvatar = true + } + + if hasAvatar { + avatarInset = layoutConstants.avatarDiameter + } else { + avatarInset = 0.0 + } + + var needShareButton = false + if item.message.id.peerId == item.account.peerId { + for attribute in item.content.firstMessage.attributes { + if let _ = attribute as? SourceReferenceMessageAttribute { + needShareButton = true + break + } + } + } else if item.message.effectivelyIncoming(item.account.peerId) { + if let peer = item.message.peers[item.message.id.peerId] { + if let channel = peer as? TelegramChannel { + if case .broadcast = channel.info { + needShareButton = true + } + } + } + if !needShareButton, let author = item.message.author as? TelegramUser, let _ = author.botInfo, !item.message.media.isEmpty { + needShareButton = true + } + if !needShareButton { + loop: for media in item.message.media { + if media is TelegramMediaGame || media is TelegramMediaInvoice { + needShareButton = true + break loop + } else if let media = media as? TelegramMediaWebpage, case .Loaded = media.content { + needShareButton = true + break loop + } + } + } else { + loop: for media in item.message.media { + if media is TelegramMediaAction { + needShareButton = false + break loop + } + } + } + } + + var layoutInsets = UIEdgeInsets(top: mergedTop.merged ? layoutConstants.bubble.mergedSpacing : layoutConstants.bubble.defaultSpacing, left: 0.0, bottom: mergedBottom.merged ? layoutConstants.bubble.mergedSpacing : layoutConstants.bubble.defaultSpacing, right: 0.0) + if dateHeaderAtBottom { + layoutInsets.top += layoutConstants.timestampHeaderHeight + } + + let displayLeftInset = params.leftInset + layoutConstants.bubble.edgeInset + avatarInset + + let imageInset: CGFloat = 10.0 + let innerImageSize = imageSize + imageSize = CGSize(width: imageSize.width + imageInset * 2.0, height: imageSize.height + imageInset * 2.0) + let imageFrame = CGRect(origin: CGPoint(x: 0.0 + (incoming ? (params.leftInset + layoutConstants.bubble.edgeInset + avatarInset + layoutConstants.bubble.contentInsets.left) : (params.width - params.rightInset - imageSize.width - layoutConstants.bubble.edgeInset - layoutConstants.bubble.contentInsets.left)), y: 0.0), size: CGSize(width: imageSize.width, height: imageSize.height)) + + let arguments = TransformImageArguments(corners: ImageCorners(), imageSize: innerImageSize, boundingSize: innerImageSize, intrinsicInsets: UIEdgeInsets(top: imageInset, left: imageInset, bottom: imageInset, right: imageInset)) + + let imageApply = imageLayout(arguments) + + let statusType: ChatMessageDateAndStatusType + if item.message.effectivelyIncoming(item.account.peerId) { + statusType = .FreeIncoming + } else { + if item.message.flags.contains(.Failed) { + statusType = .FreeOutgoing(.Failed) + } else if item.message.flags.isSending && !item.message.isSentOrAcknowledged { + statusType = .FreeOutgoing(.Sending) + } else { + statusType = .FreeOutgoing(.Sent(read: item.read)) + } + } + + let edited = false + let sentViaBot = false + var viewCount: Int? = nil + for attribute in item.message.attributes { + if let _ = attribute as? EditedMessageAttribute { + // edited = true + } else if let attribute = attribute as? ViewCountMessageAttribute { + viewCount = attribute.count + }// else if let _ = attribute as? InlineBotMessageAttribute { + // sentViaBot = true + // } + } + + let dateText = stringForMessageTimestampStatus(message: item.message, dateTimeFormat: item.presentationData.dateTimeFormat, strings: item.presentationData.strings, format: .minimal) + + let (dateAndStatusSize, dateAndStatusApply) = makeDateAndStatusLayout(item.presentationData.theme, item.presentationData.strings, edited && !sentViaBot, viewCount, dateText, statusType, CGSize(width: params.width, height: CGFloat.greatestFiniteMagnitude)) + + var replyInfoApply: (CGSize, () -> ChatMessageReplyInfoNode)? + var updatedReplyBackgroundNode: ASImageNode? + var replyBackgroundImage: UIImage? + for attribute in item.message.attributes { + if let replyAttribute = attribute as? ReplyMessageAttribute, let replyMessage = item.message.associatedMessages[replyAttribute.messageId] { + let availableWidth = max(60.0, params.width - params.leftInset - params.rightInset - imageSize.width - 20.0 - layoutConstants.bubble.edgeInset * 2.0 - avatarInset - layoutConstants.bubble.contentInsets.left) + replyInfoApply = makeReplyInfoLayout(item.presentationData.theme, item.presentationData.strings, item.account, .standalone, replyMessage, CGSize(width: availableWidth, height: CGFloat.greatestFiniteMagnitude)) + + if let currentReplyBackgroundNode = currentReplyBackgroundNode { + updatedReplyBackgroundNode = currentReplyBackgroundNode + } else { + updatedReplyBackgroundNode = ASImageNode() + } + + let graphics = PresentationResourcesChat.additionalGraphics(item.presentationData.theme.theme, wallpaper: item.presentationData.theme.wallpaper) + replyBackgroundImage = graphics.chatFreeformContentAdditionalInfoBackgroundImage + break + } + } + + var updatedShareButtonBackground: UIImage? + + var updatedShareButtonNode: HighlightableButtonNode? + if needShareButton { + if currentShareButtonNode != nil { + updatedShareButtonNode = currentShareButtonNode + if item.presentationData.theme !== currentItem?.presentationData.theme { + let graphics = PresentationResourcesChat.additionalGraphics(item.presentationData.theme.theme, wallpaper: item.presentationData.theme.wallpaper) + if item.message.id.peerId == item.account.peerId { + updatedShareButtonBackground = graphics.chatBubbleNavigateButtonImage + } else { + updatedShareButtonBackground = graphics.chatBubbleShareButtonImage + } + } + } else { + let buttonNode = HighlightableButtonNode() + let buttonIcon: UIImage? + let graphics = PresentationResourcesChat.additionalGraphics(item.presentationData.theme.theme, wallpaper: item.presentationData.theme.wallpaper) + if item.message.id.peerId == item.account.peerId { + buttonIcon = graphics.chatBubbleNavigateButtonImage + } else { + buttonIcon = graphics.chatBubbleShareButtonImage + } + buttonNode.setBackgroundImage(buttonIcon, for: [.normal]) + updatedShareButtonNode = buttonNode + } + } + + let contentHeight = max(imageSize.height, layoutConstants.image.minDimensions.height) + + return (ListViewItemNodeLayout(contentSize: CGSize(width: params.width, height: contentHeight), insets: layoutInsets), { [weak self] animation, _ in + if let strongSelf = self { + let updatedImageFrame = imageFrame.offsetBy(dx: 0.0, dy: floor((contentHeight - imageSize.height) / 2.0)) + + strongSelf.imageNode.frame = updatedImageFrame + strongSelf.animationNode.frame = updatedImageFrame + strongSelf.progressNode?.position = strongSelf.imageNode.position + imageApply() + + if let updatedShareButtonNode = updatedShareButtonNode { + if updatedShareButtonNode !== strongSelf.shareButtonNode { + if let shareButtonNode = strongSelf.shareButtonNode { + shareButtonNode.removeFromSupernode() + } + strongSelf.shareButtonNode = updatedShareButtonNode + strongSelf.addSubnode(updatedShareButtonNode) + updatedShareButtonNode.addTarget(strongSelf, action: #selector(strongSelf.shareButtonPressed), forControlEvents: .touchUpInside) + } + if let updatedShareButtonBackground = updatedShareButtonBackground { + strongSelf.shareButtonNode?.setBackgroundImage(updatedShareButtonBackground, for: [.normal]) + } + } else if let shareButtonNode = strongSelf.shareButtonNode { + shareButtonNode.removeFromSupernode() + strongSelf.shareButtonNode = nil + } + + if let shareButtonNode = strongSelf.shareButtonNode { + shareButtonNode.frame = CGRect(origin: CGPoint(x: updatedImageFrame.maxX + 8.0, y: updatedImageFrame.maxY - 30.0), size: CGSize(width: 29.0, height: 29.0)) + } + + dateAndStatusApply(false) + strongSelf.dateAndStatusNode.frame = CGRect(origin: CGPoint(x: max(displayLeftInset, updatedImageFrame.maxX - dateAndStatusSize.width - 4.0), y: updatedImageFrame.maxY - dateAndStatusSize.height - 4.0), size: dateAndStatusSize) + + if let updatedReplyBackgroundNode = updatedReplyBackgroundNode { + if strongSelf.replyBackgroundNode == nil { + strongSelf.replyBackgroundNode = updatedReplyBackgroundNode + strongSelf.addSubnode(updatedReplyBackgroundNode) + updatedReplyBackgroundNode.image = replyBackgroundImage + } + } else if let replyBackgroundNode = strongSelf.replyBackgroundNode { + replyBackgroundNode.removeFromSupernode() + strongSelf.replyBackgroundNode = nil + } + + if let (replyInfoSize, replyInfoApply) = replyInfoApply { + let replyInfoNode = replyInfoApply() + if strongSelf.replyInfoNode == nil { + strongSelf.replyInfoNode = replyInfoNode + strongSelf.addSubnode(replyInfoNode) + } + let replyInfoFrame = CGRect(origin: CGPoint(x: (!incoming ? (params.leftInset + layoutConstants.bubble.edgeInset + 10.0) : (params.width - params.rightInset - replyInfoSize.width - layoutConstants.bubble.edgeInset - 10.0)), y: 8.0), size: replyInfoSize) + replyInfoNode.frame = replyInfoFrame + strongSelf.replyBackgroundNode?.frame = CGRect(origin: CGPoint(x: replyInfoFrame.minX - 4.0, y: replyInfoFrame.minY - 2.0), size: CGSize(width: replyInfoFrame.size.width + 8.0, height: replyInfoFrame.size.height + 5.0)) + } else if let replyInfoNode = strongSelf.replyInfoNode { + replyInfoNode.removeFromSupernode() + strongSelf.replyInfoNode = nil + } + } + }) + } + } + + @objc func tapLongTapOrDoubleTapGesture(_ recognizer: TapLongTapOrDoubleTapGestureRecognizer) { + switch recognizer.state { + case .ended: + if let (gesture, location) = recognizer.lastRecognizedGestureAndLocation { + switch gesture { + case .tap: + if let avatarNode = self.accessoryItemNode as? ChatMessageAvatarAccessoryItemNode, avatarNode.frame.contains(location) { + if let item = self.item, let author = item.content.firstMessage.author { + let navigate: ChatControllerInteractionNavigateToPeer + if item.content.firstMessage.id.peerId == item.account.peerId { + navigate = .chat(textInputState: nil, messageId: nil) + } else { + navigate = .info + } + item.controllerInteraction.openPeer(item.effectiveAuthorId ?? author.id, navigate, item.message) + } + return + } + + if let replyInfoNode = self.replyInfoNode, replyInfoNode.frame.contains(location) { + if let item = self.item { + for attribute in item.message.attributes { + if let attribute = attribute as? ReplyMessageAttribute { + item.controllerInteraction.navigateToMessage(item.message.id, attribute.messageId) + return + } + } + } + } + + if let item = self.item, self.imageNode.frame.contains(location) { + self.animationNode.play() + //let _ = item.controllerInteraction.openMessage(item.message, .default) + return + } + + self.item?.controllerInteraction.clickThroughMessage() + case .longTap, .doubleTap: + if let item = self.item, self.imageNode.frame.contains(location) { + item.controllerInteraction.openMessageContextMenu(item.message, false, self, self.imageNode.frame) + } + case .hold: + break + } + } + default: + break + } + } + + @objc func shareButtonPressed() { + if let item = self.item { + if item.content.firstMessage.id.peerId == item.account.peerId { + for attribute in item.content.firstMessage.attributes { + if let attribute = attribute as? SourceReferenceMessageAttribute { + item.controllerInteraction.navigateToMessage(item.content.firstMessage.id, attribute.messageId) + break + } + } + } else { + item.controllerInteraction.openMessageShareMenu(item.message.id) + } + } + } + + @objc func swipeToReplyGesture(_ recognizer: ChatSwipeToReplyRecognizer) { + switch recognizer.state { + case .began: + self.currentSwipeToReplyTranslation = 0.0 + if self.swipeToReplyFeedback == nil { + self.swipeToReplyFeedback = HapticFeedback() + self.swipeToReplyFeedback?.prepareImpact() + } + (self.view.window as? WindowHost)?.cancelInteractiveKeyboardGestures() + case .changed: + var translation = recognizer.translation(in: self.view) + translation.x = max(-80.0, min(0.0, translation.x)) + var animateReplyNodeIn = false + if (translation.x < -45.0) != (self.currentSwipeToReplyTranslation < -45.0) { + if translation.x < -45.0, self.swipeToReplyNode == nil, let item = self.item { + self.swipeToReplyFeedback?.impact() + + let swipeToReplyNode = ChatMessageSwipeToReplyNode(fillColor: bubbleVariableColor(variableColor: item.presentationData.theme.theme.chat.bubble.shareButtonFillColor, wallpaper: item.presentationData.theme.wallpaper), strokeColor: item.presentationData.theme.theme.chat.bubble.shareButtonStrokeColor, foregroundColor: item.presentationData.theme.theme.chat.bubble.shareButtonForegroundColor) + self.swipeToReplyNode = swipeToReplyNode + self.addSubnode(swipeToReplyNode) + animateReplyNodeIn = true + } + } + self.currentSwipeToReplyTranslation = translation.x + var bounds = self.bounds + bounds.origin.x = -translation.x + self.bounds = bounds + + if let swipeToReplyNode = self.swipeToReplyNode { + swipeToReplyNode.frame = CGRect(origin: CGPoint(x: bounds.size.width, y: floor((self.contentSize.height - 33.0) / 2.0)), size: CGSize(width: 33.0, height: 33.0)) + if animateReplyNodeIn { + swipeToReplyNode.layer.animateAlpha(from: 0.0, to: 1.0, duration: 0.12) + swipeToReplyNode.layer.animateSpring(from: 0.1 as NSNumber, to: 1.0 as NSNumber, keyPath: "transform.scale", duration: 0.4) + } else { + swipeToReplyNode.alpha = min(1.0, abs(translation.x / 45.0)) + } + } + case .cancelled, .ended: + self.swipeToReplyFeedback = nil + + let translation = recognizer.translation(in: self.view) + if case .ended = recognizer.state, translation.x < -45.0 { + if let item = self.item { + item.controllerInteraction.setupReply(item.message.id) + } + } + var bounds = self.bounds + let previousBounds = bounds + bounds.origin.x = 0.0 + self.bounds = bounds + self.layer.animateBounds(from: previousBounds, to: bounds, duration: 0.3, timingFunction: kCAMediaTimingFunctionSpring) + if let swipeToReplyNode = self.swipeToReplyNode { + self.swipeToReplyNode = nil + swipeToReplyNode.layer.animateAlpha(from: 1.0, to: 0.0, duration: 0.3, removeOnCompletion: false, completion: { [weak swipeToReplyNode] _ in + swipeToReplyNode?.removeFromSupernode() + }) + swipeToReplyNode.layer.animateScale(from: 1.0, to: 0.2, duration: 0.3, timingFunction: kCAMediaTimingFunctionSpring, removeOnCompletion: false) + } + default: + break + } + } + + override func hitTest(_ point: CGPoint, with event: UIEvent?) -> UIView? { + if let shareButtonNode = self.shareButtonNode, shareButtonNode.frame.contains(point) { + return shareButtonNode.view + } + + return super.hitTest(point, with: event) + } + + override func updateSelectionState(animated: Bool) { + guard let item = self.item else { + return + } + + if let selectionState = item.controllerInteraction.selectionState { + var selected = false + var incoming = true + + selected = selectionState.selectedIds.contains(item.message.id) + incoming = item.message.effectivelyIncoming(item.account.peerId) + + let offset: CGFloat = incoming ? 42.0 : 0.0 + + if let selectionNode = self.selectionNode { + selectionNode.updateSelected(selected, animated: false) + selectionNode.frame = CGRect(origin: CGPoint(x: -offset, y: 0.0), size: CGSize(width: self.contentBounds.size.width, height: self.contentBounds.size.height)) + self.subnodeTransform = CATransform3DMakeTranslation(offset, 0.0, 0.0); + } else { + let selectionNode = ChatMessageSelectionNode(theme: item.presentationData.theme.theme, toggle: { [weak self] value in + if let strongSelf = self, let item = strongSelf.item { + item.controllerInteraction.toggleMessagesSelection([item.message.id], value) + } + }) + + selectionNode.frame = CGRect(origin: CGPoint(x: -offset, y: 0.0), size: CGSize(width: self.contentBounds.size.width, height: self.contentBounds.size.height)) + self.addSubnode(selectionNode) + self.selectionNode = selectionNode + selectionNode.updateSelected(selected, animated: false) + let previousSubnodeTransform = self.subnodeTransform + self.subnodeTransform = CATransform3DMakeTranslation(offset, 0.0, 0.0); + if animated { + selectionNode.layer.animateAlpha(from: 0.0, to: 1.0, duration: 0.3) + self.layer.animate(from: NSValue(caTransform3D: previousSubnodeTransform), to: NSValue(caTransform3D: self.subnodeTransform), keyPath: "sublayerTransform", timingFunction: kCAMediaTimingFunctionSpring, duration: 0.4) + + if !incoming { + let position = selectionNode.layer.position + selectionNode.layer.animatePosition(from: CGPoint(x: position.x - 42.0, y: position.y), to: position, duration: 0.4, timingFunction: kCAMediaTimingFunctionSpring) + } + } + } + } else { + if let selectionNode = self.selectionNode { + self.selectionNode = nil + let previousSubnodeTransform = self.subnodeTransform + self.subnodeTransform = CATransform3DIdentity + if animated { + self.layer.animate(from: NSValue(caTransform3D: previousSubnodeTransform), to: NSValue(caTransform3D: self.subnodeTransform), keyPath: "sublayerTransform", timingFunction: kCAMediaTimingFunctionSpring, duration: 0.4, completion: { [weak selectionNode]_ in + selectionNode?.removeFromSupernode() + }) + selectionNode.layer.animateAlpha(from: 1.0, to: 0.0, duration: 0.3, removeOnCompletion: false) + if CGFloat(0.0).isLessThanOrEqualTo(selectionNode.frame.origin.x) { + let position = selectionNode.layer.position + selectionNode.layer.animatePosition(from: position, to: CGPoint(x: position.x - 42.0, y: position.y), duration: 0.4, timingFunction: kCAMediaTimingFunctionSpring, removeOnCompletion: false) + } + } else { + selectionNode.removeFromSupernode() + } + } + } + } + + override func updateHighlightedState(animated: Bool) { + super.updateHighlightedState(animated: animated) + + if let item = self.item { + var highlighted = false + if let highlightedState = item.controllerInteraction.highlightedState { + if highlightedState.messageStableId == item.message.stableId { + highlighted = true + } + } + + if self.highlightedState != highlighted { + self.highlightedState = highlighted + + if highlighted { + self.imageNode.setOverlayColor(item.presentationData.theme.theme.chat.bubble.mediaHighlightOverlayColor, animated: false) + } else { + self.imageNode.setOverlayColor(nil, animated: animated) + } + } + } + } + + override func animateInsertion(_ currentTimestamp: Double, duration: Double, short: Bool) { + super.animateInsertion(currentTimestamp, duration: duration, short: short) + + self.layer.animateAlpha(from: 0.0, to: 1.0, duration: 0.2) + } + + override func animateRemoved(_ currentTimestamp: Double, duration: Double) { + super.animateRemoved(currentTimestamp, duration: duration) + + self.layer.animateAlpha(from: 1.0, to: 0.0, duration: 0.2, removeOnCompletion: false) + } + + override func animateAdded(_ currentTimestamp: Double, duration: Double) { + super.animateAdded(currentTimestamp, duration: duration) + + self.layer.animateAlpha(from: 0.0, to: 1.0, duration: 0.2) + } +} diff --git a/TelegramUI/ChatMessageBubbleMosaicLayout.swift b/TelegramUI/ChatMessageBubbleMosaicLayout.swift index 8694f4a219..76d3e8c5fb 100644 --- a/TelegramUI/ChatMessageBubbleMosaicLayout.swift +++ b/TelegramUI/ChatMessageBubbleMosaicLayout.swift @@ -58,7 +58,7 @@ func chatMessageBubbleMosaicLayout(maxSize: CGSize, itemSizes: [CGSize]) -> ([(C } averageAspectRatio += aspectRatio - return MosaicItemInfo(index: index, imageSize: itemSize, aspectRatio: aspectRatio , layoutFrame: CGRect(), position: []) + return MosaicItemInfo(index: index, imageSize: itemSize, aspectRatio: aspectRatio, layoutFrame: CGRect(), position: []) } let minWidth: CGFloat = 68.0 @@ -71,7 +71,7 @@ func chatMessageBubbleMosaicLayout(maxSize: CGSize, itemSizes: [CGSize]) -> ([(C if itemInfos.count == 2 { if proportions == "ww" && averageAspectRatio > 1.4 * maxAspectRatio && itemInfos[1].aspectRatio - itemInfos[0].aspectRatio < 0.2 { let width = maxSize.width - let height = floorToScreenPixels(min(width / itemInfos[0].aspectRatio, min(width / itemInfos[1].aspectRatio, (maxSize.height - spacing) / 2.0))) + let height = floor(min(width / itemInfos[0].aspectRatio, min(width / itemInfos[1].aspectRatio, (maxSize.height - spacing) / 2.0))) itemInfos[0].layoutFrame = CGRect(x: 0.0, y: 0.0, width: width, height: height) itemInfos[0].position = [.top, .left, .right] @@ -80,7 +80,7 @@ func chatMessageBubbleMosaicLayout(maxSize: CGSize, itemSizes: [CGSize]) -> ([(C itemInfos[1].position = [.bottom, .left, .right] } else if proportions == "ww" || proportions == "qq" { let width = (maxSize.width - spacing) / 2.0 - let height = floorToScreenPixels(min(width / itemInfos[0].aspectRatio, min(width / itemInfos[1].aspectRatio, maxSize.height))) + let height = floor(min(width / itemInfos[0].aspectRatio, min(width / itemInfos[1].aspectRatio, maxSize.height))) itemInfos[0].layoutFrame = CGRect(x: 0.0, y: 0.0, width: width, height: height) itemInfos[0].position = [.top, .left, .bottom] @@ -88,9 +88,9 @@ func chatMessageBubbleMosaicLayout(maxSize: CGSize, itemSizes: [CGSize]) -> ([(C itemInfos[1].layoutFrame = CGRect(x: width + spacing, y: 0.0, width: width, height: height) itemInfos[1].position = [.top, .right, .bottom] } else { - let secondWidth = floorToScreenPixels(min(0.5 * (maxSize.width - spacing), round((maxSize.width - spacing) / itemInfos[0].aspectRatio / (1.0 / itemInfos[0].aspectRatio + 1.0 / itemInfos[1].aspectRatio)))) + let secondWidth = floor(min(0.5 * (maxSize.width - spacing), round((maxSize.width - spacing) / itemInfos[0].aspectRatio / (1.0 / itemInfos[0].aspectRatio + 1.0 / itemInfos[1].aspectRatio)))) let firstWidth = maxSize.width - secondWidth - spacing - let height = floorToScreenPixels(min(maxSize.height, round(min(firstWidth / itemInfos[0].aspectRatio, secondWidth / itemInfos[1].aspectRatio)))) + let height = floor(min(maxSize.height, round(min(firstWidth / itemInfos[0].aspectRatio, secondWidth / itemInfos[1].aspectRatio)))) itemInfos[0].layoutFrame = CGRect(x: 0.0, y: 0.0, width: firstWidth, height: height) itemInfos[0].position = [.top, .left, .bottom] @@ -117,7 +117,7 @@ func chatMessageBubbleMosaicLayout(maxSize: CGSize, itemSizes: [CGSize]) -> ([(C itemInfos[2].position = [.right, .bottom] } else { var width = maxSize.width - let firstHeight = floorToScreenPixels(min(width / itemInfos[0].aspectRatio, (maxSize.height - spacing) * 0.66)) + let firstHeight = floor(min(width / itemInfos[0].aspectRatio, (maxSize.height - spacing) * 0.66)) itemInfos[0].layoutFrame = CGRect(x: 0.0, y: 0.0, width: width, height: firstHeight) itemInfos[0].position = [.top, .left, .right] @@ -156,8 +156,8 @@ func chatMessageBubbleMosaicLayout(maxSize: CGSize, itemSizes: [CGSize]) -> ([(C itemInfos[0].position = [.top, .left, .bottom] var w = round((maxSize.height - 2 * spacing) / (1.0 / itemInfos[1].aspectRatio + 1.0 / itemInfos[2].aspectRatio + 1.0 / itemInfos[3].aspectRatio)) - let h0 = floorToScreenPixels(w / itemInfos[1].aspectRatio) - let h1 = floorToScreenPixels(w / itemInfos[2].aspectRatio) + let h0 = floor(w / itemInfos[1].aspectRatio) + let h1 = floor(w / itemInfos[2].aspectRatio) let h2 = h - h0 - h1 - 2.0 * spacing w = max(minWidth, min(maxSize.width - w0 - spacing, w)) itemInfos[1].layoutFrame = CGRect(x: w0 + spacing, y: 0.0, width: w, height: h0) @@ -207,8 +207,6 @@ func chatMessageBubbleMosaicLayout(maxSize: CGSize, itemSizes: [CGSize]) -> ([(C } addAttempt([firstLine, croppedRatios.count - firstLine], [multiHeight(Array(croppedRatios[0.. ([(C } addAttempt([firstLine, secondLine, thirdLine], [multiHeight(Array(croppedRatios[0 ..< firstLine])), multiHeight(Array(croppedRatios[firstLine ..< croppedRatios.count - thirdLine])), multiHeight(Array(croppedRatios[firstLine + secondLine ..< croppedRatios.count]))], &attempts) - - //addAttempt(@[@(firstLine), @(secondLine), @(thirdLine)], @[multiHeight([croppedRatios subarrayWithRange:NSMakeRange(0, firstLine)]), multiHeight([croppedRatios subarrayWithRange:NSMakeRange(firstLine, croppedRatios.count - firstLine - thirdLine)]), multiHeight([croppedRatios subarrayWithRange:NSMakeRange(firstLine + secondLine, croppedRatios.count - firstLine - secondLine)])]) } } @@ -237,14 +233,12 @@ func chatMessageBubbleMosaicLayout(maxSize: CGSize, itemSizes: [CGSize]) -> ([(C } addAttempt([firstLine, secondLine, thirdLine, fourthLine], [multiHeight(Array(croppedRatios[0 ..< firstLine])), multiHeight(Array(croppedRatios[firstLine ..< croppedRatios.count - thirdLine - fourthLine])), multiHeight(Array(croppedRatios[firstLine + secondLine ..< croppedRatios.count - fourthLine])), multiHeight(Array(croppedRatios[firstLine + secondLine + thirdLine ..< croppedRatios.count]))], &attempts) - - //addAttempt(@[@(firstLine), @(secondLine), @(thirdLine), @(fourthLine)], @[multiHeight([croppedRatios subarrayWithRange:NSMakeRange(0, firstLine)]), multiHeight([croppedRatios subarrayWithRange:NSMakeRange(firstLine, croppedRatios.count - firstLine - thirdLine - fourthLine)]), multiHeight([croppedRatios subarrayWithRange:NSMakeRange(firstLine + secondLine, croppedRatios.count - firstLine - secondLine - fourthLine)]), multiHeight([croppedRatios subarrayWithRange:NSMakeRange(firstLine + secondLine + thirdLine, croppedRatios.count - firstLine - secondLine - thirdLine)])]) } } } } - let maxHeight = maxSize.width / 3.0 * 4.0 + let maxHeight = floor(maxSize.width / 3.0 * 4.0) var optimal: MosaicLayoutAttempt? = nil var optimalDiff: CGFloat = 0.0 for attempt in attempts { @@ -252,7 +246,7 @@ func chatMessageBubbleMosaicLayout(maxSize: CGSize, itemSizes: [CGSize]) -> ([(C var minLineHeight: CGFloat = .greatestFiniteMagnitude var maxLineHeight: CGFloat = 0.0 for h in attempt.heights { - totalHeight += h + totalHeight += floor(h) if totalHeight < minLineHeight { minLineHeight = totalHeight } @@ -284,7 +278,7 @@ func chatMessageBubbleMosaicLayout(maxSize: CGSize, itemSizes: [CGSize]) -> ([(C if let optimal = optimal { for i in 0 ..< optimal.lineCounts.count { let count = optimal.lineCounts[i] - let lineHeight = optimal.heights[i] + let lineHeight = ceil(optimal.heights[i]) var x: CGFloat = 0.0 var positionFlags: MosaicItemPosition = [] @@ -310,7 +304,7 @@ func chatMessageBubbleMosaicLayout(maxSize: CGSize, itemSizes: [CGSize]) -> ([(C } let ratio = croppedRatios[index] - let width = ratio * lineHeight + let width = ceil(ratio * lineHeight) itemInfos[index].layoutFrame = CGRect(x: x, y: y, width: width, height: lineHeight) itemInfos[index].position = innerPositionFlags @@ -320,6 +314,31 @@ func chatMessageBubbleMosaicLayout(maxSize: CGSize, itemSizes: [CGSize]) -> ([(C y += lineHeight + spacing } + + index = 0 + var maxWidth: CGFloat = 0.0 + for i in 0 ..< optimal.lineCounts.count { + let count = optimal.lineCounts[i] + for k in 0 ..< count { + if k == count - 1 { + maxWidth = max(maxWidth, itemInfos[index].layoutFrame.maxX) + } + index += 1 + } + } + + index = 0 + for i in 0 ..< optimal.lineCounts.count { + let count = optimal.lineCounts[i] + for k in 0 ..< count { + if k == count - 1 { + var frame = itemInfos[index].layoutFrame + frame.size.width = max(frame.width, maxWidth - frame.minX) + itemInfos[index].layoutFrame = frame + } + index += 1 + } + } } } diff --git a/TelegramUI/ChatMessageInteractiveFileNode.swift b/TelegramUI/ChatMessageInteractiveFileNode.swift index 6c14d04ad7..3ea2132437 100644 --- a/TelegramUI/ChatMessageInteractiveFileNode.swift +++ b/TelegramUI/ChatMessageInteractiveFileNode.swift @@ -258,7 +258,7 @@ final class ChatMessageInteractiveFileNode: ASDisplayNode { |> map { status in switch status.mediaStatus { case let .fetchStatus(fetchStatus): - if !voice { + if !voice && !message.flags.isSending { return FileMediaResourceStatus(mediaStatus: .fetchStatus(.Local), fetchStatus: status.fetchStatus) } else { return FileMediaResourceStatus(mediaStatus: .fetchStatus(fetchStatus), fetchStatus: status.fetchStatus) @@ -623,7 +623,9 @@ final class ChatMessageInteractiveFileNode: ASDisplayNode { let state: RadialStatusNodeState var streamingState: RadialStatusNodeState = .none - if isAudio && !isVoice { + let isSending = message.flags.isSending + + if isAudio && !isVoice && !isSending { let streamingStatusForegroundColor: UIColor = incoming ? bubbleTheme.incomingAccentControlColor : bubbleTheme.outgoingAccentControlColor let streamingStatusBackgroundColor: UIColor = incoming ? bubbleTheme.incomingMediaInactiveControlColor : bubbleTheme.outgoingMediaInactiveControlColor switch resourceStatus.fetchStatus { diff --git a/TelegramUI/ChatMessageInteractiveMediaNode.swift b/TelegramUI/ChatMessageInteractiveMediaNode.swift index e9ae3cc2a5..515f0323f9 100644 --- a/TelegramUI/ChatMessageInteractiveMediaNode.swift +++ b/TelegramUI/ChatMessageInteractiveMediaNode.swift @@ -283,8 +283,14 @@ final class ChatMessageInteractiveMediaNode: ASDisplayNode { return chatSecretPhoto(account: account, photoReference: .message(message: MessageReference(message), media: image)) } } else { + let tinyThumbnailData: TinyThumbnailData? + if GlobalExperimentalSettings.enableTinyThumbnails { + tinyThumbnailData = parseTinyThumbnail(message.text) + } else { + tinyThumbnailData = nil + } updateImageSignal = { synchronousLoad in - return chatMessagePhoto(postbox: account.postbox, photoReference: .message(message: MessageReference(message), media: image), synchronousLoad: synchronousLoad) + return chatMessagePhoto(postbox: account.postbox, photoReference: .message(message: MessageReference(message), media: image), synchronousLoad: synchronousLoad, tinyThumbnailData: tinyThumbnailData) } } @@ -429,7 +435,12 @@ final class ChatMessageInteractiveMediaNode: ASDisplayNode { strongSelf.currentImageArguments = arguments imageApply() - strongSelf.statusNode?.position = CGPoint(x: imageFrame.midX, y: imageFrame.midY) + if let statusNode = strongSelf.statusNode { + var statusFrame = statusNode.frame + statusFrame.origin.x = floor(imageFrame.midX - statusFrame.width / 2.0) + statusFrame.origin.y = floor(imageFrame.midY - statusFrame.height / 2.0) + statusNode.frame = statusFrame + } if let replaceVideoNode = replaceVideoNode { if let videoNode = strongSelf.videoNode { @@ -581,8 +592,8 @@ final class ChatMessageInteractiveMediaNode: ASDisplayNode { if progressRequired { if self.statusNode == nil { let statusNode = RadialStatusNode(backgroundNodeColor: theme.chat.bubble.mediaOverlayControlBackgroundColor) - statusNode.frame = CGRect(origin: CGPoint(), size: CGSize(width: radialStatusSize, height: radialStatusSize)) - statusNode.position = self.imageNode.position + let imagePosition = self.imageNode.position + statusNode.frame = CGRect(origin: CGPoint(x: floor(imagePosition.x - radialStatusSize / 2.0), y: floor(imagePosition.y - radialStatusSize / 2.0)), size: CGSize(width: radialStatusSize, height: radialStatusSize)) self.statusNode = statusNode self.addSubnode(statusNode) } diff --git a/TelegramUI/ChatMessageItem.swift b/TelegramUI/ChatMessageItem.swift index c82e63dadd..ff60e74ae5 100644 --- a/TelegramUI/ChatMessageItem.swift +++ b/TelegramUI/ChatMessageItem.swift @@ -314,11 +314,15 @@ public final class ChatMessageItem: ListViewItem, CustomStringConvertible { self.accessoryItem = accessoryItem } - public func nodeConfiguredForParams(async: @escaping (@escaping () -> Void) -> Void, params: ListViewItemLayoutParams, synchronousLoads: Bool, previousItem: ListViewItem?, nextItem: ListViewItem?, completion: @escaping (ListViewItemNode, @escaping () -> (Signal?, () -> Void)) -> Void) { + public func nodeConfiguredForParams(async: @escaping (@escaping () -> Void) -> Void, params: ListViewItemLayoutParams, synchronousLoads: Bool, previousItem: ListViewItem?, nextItem: ListViewItem?, completion: @escaping (ListViewItemNode, @escaping () -> (Signal?, (ListViewItemApply) -> Void)) -> Void) { var viewClassName: AnyClass = ChatMessageBubbleItemNode.self loop: for media in message.media { if let telegramFile = media as? TelegramMediaFile { + if GlobalExperimentalSettings.animatedStickers && telegramFile.fileName == "animation.json" { + viewClassName = ChatMessageAnimatedStickerItemNode.self + break loop + } for attribute in telegramFile.attributes { switch attribute { case .Sticker: @@ -356,7 +360,7 @@ public final class ChatMessageItem: ListViewItem, CustomStringConvertible { Queue.mainQueue().async { completion(node, { - return (nil, { apply(.None, synchronousLoads) }) + return (nil, { _ in apply(.None, synchronousLoads) }) }) } } @@ -400,7 +404,7 @@ public final class ChatMessageItem: ListViewItem, CustomStringConvertible { return (mergedTop, mergedBottom, dateAtBottom) } - public func updateNode(async: @escaping (@escaping () -> Void) -> Void, node: @escaping () -> ListViewItemNode, params: ListViewItemLayoutParams, previousItem: ListViewItem?, nextItem: ListViewItem?, animation: ListViewItemUpdateAnimation, completion: @escaping (ListViewItemNodeLayout, @escaping () -> Void) -> Void) { + public func updateNode(async: @escaping (@escaping () -> Void) -> Void, node: @escaping () -> ListViewItemNode, params: ListViewItemLayoutParams, previousItem: ListViewItem?, nextItem: ListViewItem?, animation: ListViewItemUpdateAnimation, completion: @escaping (ListViewItemNodeLayout, @escaping (ListViewItemApply) -> Void) -> Void) { Queue.mainQueue().async { if let nodeValue = node() as? ChatMessageItemView { nodeValue.setupItem(self) @@ -412,7 +416,7 @@ public final class ChatMessageItem: ListViewItem, CustomStringConvertible { let (layout, apply) = nodeLayout(self, params, top, bottom, dateAtBottom && !self.disableDate) Queue.mainQueue().async { - completion(layout, { + completion(layout, { _ in apply(animation, false) if let nodeValue = node() as? ChatMessageItemView { nodeValue.updateSelectionState(animated: false) diff --git a/TelegramUI/ChatMessageItemView.swift b/TelegramUI/ChatMessageItemView.swift index e90f1e201d..f58a87d4b2 100644 --- a/TelegramUI/ChatMessageItemView.swift +++ b/TelegramUI/ChatMessageItemView.swift @@ -66,7 +66,7 @@ struct ChatMessageItemLayoutConstants { self.bubble = ChatMessageItemBubbleLayoutConstants(edgeInset: 4.0, defaultSpacing: 2.0 + UIScreenPixel, mergedSpacing: 1.0, maximumWidthFill: ChatMessageItemWidthFill(compactInset: 40.0, compactWidthBoundary: 500.0, freeMaximumFillFactor: 0.85), minimumSize: CGSize(width: 40.0, height: 35.0), contentInsets: UIEdgeInsets(top: 0.0, left: 6.0, bottom: 0.0, right: 0.0)) self.text = ChatMessageItemTextLayoutConstants(bubbleInsets: UIEdgeInsets(top: 6.0 + UIScreenPixel, left: 12.0, bottom: 6.0 - UIScreenPixel, right: 12.0)) - self.image = ChatMessageItemImageLayoutConstants(bubbleInsets: UIEdgeInsets(top: 1.5, left: 1.5, bottom: 1.5, right: 1.5), statusInsets: UIEdgeInsets(top: 0.0, left: 0.0, bottom: 6.0, right: 6.0), defaultCornerRadius: 17.0, mergedCornerRadius: 5.0, contentMergedCornerRadius: 5.0, maxDimensions: CGSize(width: 300.0, height: 300.0), minDimensions: CGSize(width: 74.0, height: 74.0)) + self.image = ChatMessageItemImageLayoutConstants(bubbleInsets: UIEdgeInsets(top: 1.0 + UIScreenPixel, left: 1.0 + UIScreenPixel, bottom: 1.0 + UIScreenPixel, right: 1.0 + UIScreenPixel), statusInsets: UIEdgeInsets(top: 0.0, left: 0.0, bottom: 6.0, right: 6.0), defaultCornerRadius: 17.0, mergedCornerRadius: 5.0, contentMergedCornerRadius: 5.0, maxDimensions: CGSize(width: 300.0, height: 300.0), minDimensions: CGSize(width: 74.0, height: 74.0)) self.file = ChatMessageItemFileLayoutConstants(bubbleInsets: UIEdgeInsets(top: 15.0, left: 9.0, bottom: 15.0, right: 12.0)) self.instantVideo = ChatMessageItemInstantVideoConstants(insets: UIEdgeInsets(top: 4.0, left: 0.0, bottom: 4.0, right: 0.0), dimensions: CGSize(width: 212.0, height: 212.0)) } diff --git a/TelegramUI/ChatPanelInterfaceInteraction.swift b/TelegramUI/ChatPanelInterfaceInteraction.swift index ca81ae50b9..bea6418dc1 100644 --- a/TelegramUI/ChatPanelInterfaceInteraction.swift +++ b/TelegramUI/ChatPanelInterfaceInteraction.swift @@ -49,6 +49,7 @@ final class ChatPanelInterfaceInteraction { let shareSelectedMessages: () -> Void let updateTextInputStateAndMode: (@escaping (ChatTextInputState, ChatInputMode) -> (ChatTextInputState, ChatInputMode)) -> Void let updateInputModeAndDismissedButtonKeyboardMessageId: ((ChatPresentationInterfaceState) -> (ChatInputMode, MessageId?)) -> Void + let openStickers: () -> Void let editMessage: () -> Void let beginMessageSearch: (ChatSearchDomain, String) -> Void let dismissMessageSearch: () -> Void @@ -90,7 +91,7 @@ final class ChatPanelInterfaceInteraction { let toggleSilentPost: () -> Void let statuses: ChatPanelInterfaceInteractionStatuses? - init(setupReplyMessage: @escaping (MessageId) -> Void, setupEditMessage: @escaping (MessageId?) -> Void, beginMessageSelection: @escaping ([MessageId]) -> Void, deleteSelectedMessages: @escaping () -> Void, reportSelectedMessages: @escaping () -> Void, reportMessages: @escaping ([Message]) -> Void, deleteMessages: @escaping ([Message]) -> Void, forwardSelectedMessages: @escaping () -> Void, forwardMessages: @escaping ([Message]) -> Void, shareSelectedMessages: @escaping () -> Void, updateTextInputStateAndMode: @escaping ((ChatTextInputState, ChatInputMode) -> (ChatTextInputState, ChatInputMode)) -> Void, updateInputModeAndDismissedButtonKeyboardMessageId: @escaping ((ChatPresentationInterfaceState) -> (ChatInputMode, MessageId?)) -> Void, editMessage: @escaping () -> Void, beginMessageSearch: @escaping (ChatSearchDomain, String) -> Void, dismissMessageSearch: @escaping () -> Void, updateMessageSearch: @escaping (String) -> Void, navigateMessageSearch: @escaping (ChatPanelSearchNavigationAction) -> Void, openCalendarSearch: @escaping () -> Void, toggleMembersSearch: @escaping (Bool) -> Void, navigateToMessage: @escaping (MessageId) -> Void, openPeerInfo: @escaping () -> Void, togglePeerNotifications: @escaping () -> Void, sendContextResult: @escaping (ChatContextResultCollection, ChatContextResult) -> Void, sendBotCommand: @escaping (Peer, String) -> Void, sendBotStart: @escaping (String?) -> Void, botSwitchChatWithPayload: @escaping (PeerId, String) -> Void, beginMediaRecording: @escaping (Bool) -> Void, finishMediaRecording: @escaping (ChatFinishMediaRecordingAction) -> Void, stopMediaRecording: @escaping () -> Void, lockMediaRecording: @escaping () -> Void, deleteRecordedMedia: @escaping () -> Void, sendRecordedMedia: @escaping () -> Void, displayRestrictedInfo: @escaping (ChatPanelRestrictionInfoSubject) -> Void, switchMediaRecordingMode: @escaping () -> Void, setupMessageAutoremoveTimeout: @escaping () -> Void, sendSticker: @escaping (FileMediaReference) -> Void, unblockPeer: @escaping () -> Void, pinMessage: @escaping (MessageId) -> Void, unpinMessage: @escaping () -> Void, reportPeer: @escaping () -> Void, presentPeerContact: @escaping () -> Void, dismissReportPeer: @escaping () -> Void, deleteChat: @escaping () -> Void, beginCall: @escaping () -> Void, toggleMessageStickerStarred: @escaping (MessageId) -> Void, presentController: @escaping (ViewController, Any?) -> Void, getNavigationController: @escaping () -> NavigationController?, presentGlobalOverlayController: @escaping (ViewController, Any?) -> Void, navigateFeed: @escaping () -> Void, openGrouping: @escaping () -> Void, toggleSilentPost: @escaping () -> Void, statuses: ChatPanelInterfaceInteractionStatuses?) { + init(setupReplyMessage: @escaping (MessageId) -> Void, setupEditMessage: @escaping (MessageId?) -> Void, beginMessageSelection: @escaping ([MessageId]) -> Void, deleteSelectedMessages: @escaping () -> Void, reportSelectedMessages: @escaping () -> Void, reportMessages: @escaping ([Message]) -> Void, deleteMessages: @escaping ([Message]) -> Void, forwardSelectedMessages: @escaping () -> Void, forwardMessages: @escaping ([Message]) -> Void, shareSelectedMessages: @escaping () -> Void, updateTextInputStateAndMode: @escaping ((ChatTextInputState, ChatInputMode) -> (ChatTextInputState, ChatInputMode)) -> Void, updateInputModeAndDismissedButtonKeyboardMessageId: @escaping ((ChatPresentationInterfaceState) -> (ChatInputMode, MessageId?)) -> Void, openStickers: @escaping () -> Void, editMessage: @escaping () -> Void, beginMessageSearch: @escaping (ChatSearchDomain, String) -> Void, dismissMessageSearch: @escaping () -> Void, updateMessageSearch: @escaping (String) -> Void, navigateMessageSearch: @escaping (ChatPanelSearchNavigationAction) -> Void, openCalendarSearch: @escaping () -> Void, toggleMembersSearch: @escaping (Bool) -> Void, navigateToMessage: @escaping (MessageId) -> Void, openPeerInfo: @escaping () -> Void, togglePeerNotifications: @escaping () -> Void, sendContextResult: @escaping (ChatContextResultCollection, ChatContextResult) -> Void, sendBotCommand: @escaping (Peer, String) -> Void, sendBotStart: @escaping (String?) -> Void, botSwitchChatWithPayload: @escaping (PeerId, String) -> Void, beginMediaRecording: @escaping (Bool) -> Void, finishMediaRecording: @escaping (ChatFinishMediaRecordingAction) -> Void, stopMediaRecording: @escaping () -> Void, lockMediaRecording: @escaping () -> Void, deleteRecordedMedia: @escaping () -> Void, sendRecordedMedia: @escaping () -> Void, displayRestrictedInfo: @escaping (ChatPanelRestrictionInfoSubject) -> Void, switchMediaRecordingMode: @escaping () -> Void, setupMessageAutoremoveTimeout: @escaping () -> Void, sendSticker: @escaping (FileMediaReference) -> Void, unblockPeer: @escaping () -> Void, pinMessage: @escaping (MessageId) -> Void, unpinMessage: @escaping () -> Void, reportPeer: @escaping () -> Void, presentPeerContact: @escaping () -> Void, dismissReportPeer: @escaping () -> Void, deleteChat: @escaping () -> Void, beginCall: @escaping () -> Void, toggleMessageStickerStarred: @escaping (MessageId) -> Void, presentController: @escaping (ViewController, Any?) -> Void, getNavigationController: @escaping () -> NavigationController?, presentGlobalOverlayController: @escaping (ViewController, Any?) -> Void, navigateFeed: @escaping () -> Void, openGrouping: @escaping () -> Void, toggleSilentPost: @escaping () -> Void, statuses: ChatPanelInterfaceInteractionStatuses?) { self.setupReplyMessage = setupReplyMessage self.setupEditMessage = setupEditMessage self.beginMessageSelection = beginMessageSelection @@ -103,6 +104,7 @@ final class ChatPanelInterfaceInteraction { self.shareSelectedMessages = shareSelectedMessages self.updateTextInputStateAndMode = updateTextInputStateAndMode self.updateInputModeAndDismissedButtonKeyboardMessageId = updateInputModeAndDismissedButtonKeyboardMessageId + self.openStickers = openStickers self.editMessage = editMessage self.beginMessageSearch = beginMessageSearch self.dismissMessageSearch = dismissMessageSearch diff --git a/TelegramUI/ChatRecentActionsController.swift b/TelegramUI/ChatRecentActionsController.swift index 073fcedb02..82dfea5df8 100644 --- a/TelegramUI/ChatRecentActionsController.swift +++ b/TelegramUI/ChatRecentActionsController.swift @@ -48,6 +48,7 @@ final class ChatRecentActionsController: TelegramController { }, shareSelectedMessages: { }, updateTextInputStateAndMode: { _ in }, updateInputModeAndDismissedButtonKeyboardMessageId: { _ in + }, openStickers: { }, editMessage: { }, beginMessageSearch: { _, _ in }, dismissMessageSearch: { diff --git a/TelegramUI/ChatRecentActionsControllerNode.swift b/TelegramUI/ChatRecentActionsControllerNode.swift index fbe4076e11..d74218a9c1 100644 --- a/TelegramUI/ChatRecentActionsControllerNode.swift +++ b/TelegramUI/ChatRecentActionsControllerNode.swift @@ -734,7 +734,7 @@ final class ChatRecentActionsControllerNode: ViewControllerTracingNode { }), nil) case let .localization(identifier): strongSelf.presentController(LanguageLinkPreviewController(account: strongSelf.account, identifier: identifier), nil) - case .proxy, .confirmationCode: + case .proxy, .confirmationCode, .cancelAccountReset, .share: openResolvedUrl(result, account: strongSelf.account, navigationController: strongSelf.getNavigationController(), openPeer: { peerId, _ in if let strongSelf = self { strongSelf.openPeer(peerId: peerId, peer: nil) diff --git a/TelegramUI/ChatTextInputAudioRecordingTimeNode.swift b/TelegramUI/ChatTextInputAudioRecordingTimeNode.swift index 12c6c77bb4..b607c67959 100644 --- a/TelegramUI/ChatTextInputAudioRecordingTimeNode.swift +++ b/TelegramUI/ChatTextInputAudioRecordingTimeNode.swift @@ -38,6 +38,8 @@ final class ChatTextInputAudioRecordingTimeNode: ASDisplayNode { strongSelf.timestamp = duration case let .recording(duration, _): strongSelf.timestamp = duration + case .stopped: + break } } })) diff --git a/TelegramUI/ChatTextInputMediaRecordingButton.swift b/TelegramUI/ChatTextInputMediaRecordingButton.swift index 4efc590bd7..592e341367 100644 --- a/TelegramUI/ChatTextInputMediaRecordingButton.swift +++ b/TelegramUI/ChatTextInputMediaRecordingButton.swift @@ -350,7 +350,7 @@ final class ChatTextInputMediaRecordingButton: TGModernConversationInputMicButto func micButtonInteractionCancelled(_ velocity: CGPoint) { //print("\(CFAbsoluteTimeGetCurrent()) cancelled") self.modeTimeoutTimer?.invalidate() - self.endRecording(false) + self.stopRecording() } func micButtonInteractionCompleted(_ velocity: CGPoint) { diff --git a/TelegramUI/ChatTextInputPanelNode.swift b/TelegramUI/ChatTextInputPanelNode.swift index 3a85cd2e9c..c5ddcc9b58 100644 --- a/TelegramUI/ChatTextInputPanelNode.swift +++ b/TelegramUI/ChatTextInputPanelNode.swift @@ -1425,9 +1425,7 @@ class ChatTextInputPanelNode: ChatInputPanelNode, ASEditableTextNodeDelegate { switch item { case let .stickers(enabled): if enabled { - self.interfaceInteraction?.updateInputModeAndDismissedButtonKeyboardMessageId({ state in - return (.media(mode: .other, expanded: nil), state.interfaceState.messageActionsState.closedButtonKeyboardMessageId) - }) + self.interfaceInteraction?.openStickers() } else { self.interfaceInteraction?.displayRestrictedInfo(.stickers) } diff --git a/TelegramUI/ChatUnreadItem.swift b/TelegramUI/ChatUnreadItem.swift index 4bdf4de685..25fd8fe719 100644 --- a/TelegramUI/ChatUnreadItem.swift +++ b/TelegramUI/ChatUnreadItem.swift @@ -18,19 +18,19 @@ class ChatUnreadItem: ListViewItem { self.header = ChatMessageDateHeader(timestamp: index.timestamp, presentationData: presentationData) } - func nodeConfiguredForParams(async: @escaping (@escaping () -> Void) -> Void, params: ListViewItemLayoutParams, synchronousLoads: Bool, previousItem: ListViewItem?, nextItem: ListViewItem?, completion: @escaping (ListViewItemNode, @escaping () -> (Signal?, () -> Void)) -> Void) { + func nodeConfiguredForParams(async: @escaping (@escaping () -> Void) -> Void, params: ListViewItemLayoutParams, synchronousLoads: Bool, previousItem: ListViewItem?, nextItem: ListViewItem?, completion: @escaping (ListViewItemNode, @escaping () -> (Signal?, (ListViewItemApply) -> Void)) -> Void) { async { let node = ChatUnreadItemNode() node.layoutForParams(params, item: self, previousItem: previousItem, nextItem: nextItem) Queue.mainQueue().async { completion(node, { - return (nil, {}) + return (nil, { _ in }) }) } } } - public func updateNode(async: @escaping (@escaping () -> Void) -> Void, node: @escaping () -> ListViewItemNode, params: ListViewItemLayoutParams, previousItem: ListViewItem?, nextItem: ListViewItem?, animation: ListViewItemUpdateAnimation, completion: @escaping (ListViewItemNodeLayout, @escaping () -> Void) -> Void) { + public func updateNode(async: @escaping (@escaping () -> Void) -> Void, node: @escaping () -> ListViewItemNode, params: ListViewItemLayoutParams, previousItem: ListViewItem?, nextItem: ListViewItem?, animation: ListViewItemUpdateAnimation, completion: @escaping (ListViewItemNodeLayout, @escaping (ListViewItemApply) -> Void) -> Void) { Queue.mainQueue().async { if let nodeValue = node() as? ChatUnreadItemNode { let nodeLayout = nodeValue.asyncLayout() @@ -40,7 +40,7 @@ class ChatUnreadItem: ListViewItem { let (layout, apply) = nodeLayout(self, params, dateAtBottom) Queue.mainQueue().async { - completion(layout, { + completion(layout, { _ in apply() }) } diff --git a/TelegramUI/CheckDeviceAccess.swift b/TelegramUI/CheckDeviceAccess.swift index 610b234bf8..963cd8bcb2 100644 --- a/TelegramUI/CheckDeviceAccess.swift +++ b/TelegramUI/CheckDeviceAccess.swift @@ -46,6 +46,7 @@ public enum AccessType { case allowed case denied case restricted + case unreachable } private let cachedMediaLibraryAccessStatus = Atomic(value: nil) @@ -56,8 +57,6 @@ public final class DeviceAccess { return self.contactsPromise.get() } - private static let notificationsPromise = Promise(nil) - public static func isMicrophoneAccessAuthorized() -> Bool? { return AVAudioSession.sharedInstance().recordPermission() == .granted } @@ -70,7 +69,11 @@ public final class DeviceAccess { UNUserNotificationCenter.current().getNotificationSettings(completionHandler: { settings in switch settings.authorizationStatus { case .authorized: - subscriber.putNext(.allowed) + if settings.alertSetting == .disabled || settings.soundSetting == .disabled || settings.badgeSetting == .disabled || settings.notificationCenterSetting == .disabled || settings.lockScreenSetting == .disabled { + subscriber.putNext(.unreachable) + } else { + subscriber.putNext(.allowed) + } case .denied: subscriber.putNext(.denied) case .notDetermined: @@ -158,7 +161,7 @@ public final class DeviceAccess { } } - public static func authorizeAccess(to subject: DeviceAccessSubject, presentationData: PresentationData? = nil, present: @escaping (ViewController, Any?) -> Void = { _, _ in }, openSettings: @escaping () -> Void = { }, displayNotificationFromBackground: @escaping (String) -> Void = { _ in }, _ completion: @escaping (Bool) -> Void = { _ in }) { + public static func authorizeAccess(to subject: DeviceAccessSubject, account: Account? = nil, presentationData: PresentationData? = nil, present: @escaping (ViewController, Any?) -> Void = { _, _ in }, openSettings: @escaping () -> Void = { }, displayNotificationFromBackground: @escaping (String) -> Void = { _ in }, _ completion: @escaping (Bool) -> Void = { _ in }) { switch subject { case .camera: let status = PGCamera.cameraAuthorizationStatus() @@ -340,6 +343,12 @@ public final class DeviceAccess { } } }) + case .notifications: + if let account = account { + account.telegramApplicationContext.applicationBindings.registerForNotifications({ result in + completion(result) + }) + } default: break } diff --git a/TelegramUI/CommandChatInputPanelItem.swift b/TelegramUI/CommandChatInputPanelItem.swift index 44e897a764..cb410f59ce 100644 --- a/TelegramUI/CommandChatInputPanelItem.swift +++ b/TelegramUI/CommandChatInputPanelItem.swift @@ -20,7 +20,7 @@ final class CommandChatInputPanelItem: ListViewItem { self.commandSelected = commandSelected } - public func nodeConfiguredForParams(async: @escaping (@escaping () -> Void) -> Void, params: ListViewItemLayoutParams, synchronousLoads: Bool, previousItem: ListViewItem?, nextItem: ListViewItem?, completion: @escaping (ListViewItemNode, @escaping () -> (Signal?, () -> Void)) -> Void) { + public func nodeConfiguredForParams(async: @escaping (@escaping () -> Void) -> Void, params: ListViewItemLayoutParams, synchronousLoads: Bool, previousItem: ListViewItem?, nextItem: ListViewItem?, completion: @escaping (ListViewItemNode, @escaping () -> (Signal?, (ListViewItemApply) -> Void)) -> Void) { let configure = { () -> Void in let node = CommandChatInputPanelItemNode() @@ -33,7 +33,7 @@ final class CommandChatInputPanelItem: ListViewItem { Queue.mainQueue().async { completion(node, { - return (nil, { apply(.None) }) + return (nil, { _ in apply(.None) }) }) } } @@ -46,7 +46,7 @@ final class CommandChatInputPanelItem: ListViewItem { } } - public func updateNode(async: @escaping (@escaping () -> Void) -> Void, node: @escaping () -> ListViewItemNode, params: ListViewItemLayoutParams, previousItem: ListViewItem?, nextItem: ListViewItem?, animation: ListViewItemUpdateAnimation, completion: @escaping (ListViewItemNodeLayout, @escaping () -> Void) -> Void) { + public func updateNode(async: @escaping (@escaping () -> Void) -> Void, node: @escaping () -> ListViewItemNode, params: ListViewItemLayoutParams, previousItem: ListViewItem?, nextItem: ListViewItem?, animation: ListViewItemUpdateAnimation, completion: @escaping (ListViewItemNodeLayout, @escaping (ListViewItemApply) -> Void) -> Void) { Queue.mainQueue().async { if let nodeValue = node() as? CommandChatInputPanelItemNode { let nodeLayout = nodeValue.asyncLayout() @@ -56,7 +56,7 @@ final class CommandChatInputPanelItem: ListViewItem { let (layout, apply) = nodeLayout(self, params, top, bottom) Queue.mainQueue().async { - completion(layout, { + completion(layout, { _ in apply(animation) }) } diff --git a/TelegramUI/ConfirmPhoneNumberController.swift b/TelegramUI/ConfirmPhoneNumberController.swift new file mode 100644 index 0000000000..811ccfa9ba --- /dev/null +++ b/TelegramUI/ConfirmPhoneNumberController.swift @@ -0,0 +1,331 @@ +import Foundation +import Display +import SwiftSignalKit +import Postbox +import TelegramCore + +private final class ConfirmPhoneNumberCodeControllerArguments { + let updateEntryText: (String) -> Void + let next: () -> Void + + init(updateEntryText: @escaping (String) -> Void, next: @escaping () -> Void) { + self.updateEntryText = updateEntryText + self.next = next + } +} + +private enum ConfirmPhoneNumberCodeSection: Int32 { + case code +} + +private enum ConfirmPhoneNumberCodeTag: ItemListItemTag { + case input + + func isEqual(to other: ItemListItemTag) -> Bool { + if let other = other as? ConfirmPhoneNumberCodeTag { + switch self { + case .input: + if case .input = other { + return true + } else { + return false + } + } + } else { + return false + } + } +} + +private enum ConfirmPhoneNumberCodeEntry: ItemListNodeEntry { + case codeEntry(PresentationTheme, String, String) + case codeInfo(PresentationTheme, PresentationStrings, String, String) + + var section: ItemListSectionId { + return ConfirmPhoneNumberCodeSection.code.rawValue + } + + var stableId: Int32 { + switch self { + case .codeEntry: + return 1 + case .codeInfo: + return 2 + } + } + + static func ==(lhs: ConfirmPhoneNumberCodeEntry, rhs: ConfirmPhoneNumberCodeEntry) -> Bool { + switch lhs { + case let .codeEntry(lhsTheme, lhsTitle, lhsText): + if case let .codeEntry(rhsTheme, rhsTitle, rhsText) = rhs, lhsTheme === rhsTheme, lhsTitle == rhsTitle, lhsText == rhsText { + return true + } else { + return false + } + case let .codeInfo(lhsTheme, lhsStrings, lhsPhoneNumber, lhsText): + if case let .codeInfo(rhsTheme, rhsStrings, rhsPhoneNumber, rhsText) = rhs, lhsTheme === rhsTheme, lhsStrings === rhsStrings, lhsPhoneNumber == rhsPhoneNumber, lhsText == rhsText { + return true + } else { + return false + } + } + } + + static func <(lhs: ConfirmPhoneNumberCodeEntry, rhs: ConfirmPhoneNumberCodeEntry) -> Bool { + return lhs.stableId < rhs.stableId + } + + func item(_ arguments: ConfirmPhoneNumberCodeControllerArguments) -> ListViewItem { + switch self { + case let .codeEntry(theme, title, text): + return ItemListSingleLineInputItem(theme: theme, title: NSAttributedString(string: title, textColor: .black), text: text, placeholder: "", type: .number, spacing: 10.0, tag: ConfirmPhoneNumberCodeTag.input, sectionId: self.section, textUpdated: { updatedText in + arguments.updateEntryText(updatedText) + }, action: { + arguments.next() + }) + case let .codeInfo(theme, strings, phoneNumber, nextOptionText): + let formattedNumber = formatPhoneNumber(phoneNumber) + let stringAndRanges = strings.CancelResetAccount_TextSMS(formattedNumber) + var result = "" + result += stringAndRanges.0 + if let range = result.range(of: formattedNumber) { + result.insert("*", at: range.upperBound) + result.insert("*", at: range.upperBound) + result.insert("*", at: range.lowerBound) + result.insert("*", at: range.lowerBound) + } + if !nextOptionText.isEmpty { + result += "\n\n" + nextOptionText + } + return ItemListTextItem(theme: theme, text: .markdown(result), sectionId: self.section) + } + } +} + +private struct ConfirmPhoneNumberCodeControllerState: Equatable { + var codeText: String + var checking: Bool + + init(codeText: String, checking: Bool) { + self.codeText = codeText + self.checking = checking + } +} + +private func confirmPhoneNumberCodeControllerEntries(presentationData: PresentationData, state: ConfirmPhoneNumberCodeControllerState, phoneNumber: String, codeData: CancelAccountResetData, timeout: Int32?, strings: PresentationStrings, theme: AuthorizationTheme) -> [ConfirmPhoneNumberCodeEntry] { + var entries: [ConfirmPhoneNumberCodeEntry] = [] + + entries.append(.codeEntry(presentationData.theme, presentationData.strings.ChangePhoneNumberCode_CodePlaceholder, state.codeText)) + var text = "" + if let nextType = codeData.nextType { + text += authorizationNextOptionText(currentType: codeData.type, nextType: nextType, timeout: timeout, strings: presentationData.strings, primaryColor: .black, accentColor: .black).0.string + } + entries.append(.codeInfo(presentationData.theme, presentationData.strings, phoneNumber, text)) + + return entries +} + +private func timeoutSignal(codeData: CancelAccountResetData) -> Signal { + if let _ = codeData.nextType, let timeout = codeData.timeout { + return Signal { subscriber in + let value = Atomic(value: timeout) + subscriber.putNext(timeout) + + let timer = SwiftSignalKit.Timer(timeout: 1.0, repeat: true, completion: { + subscriber.putNext(value.modify { value in + return max(0, value - 1) + }) + }, queue: Queue.mainQueue()) + timer.start() + + return ActionDisposable { + timer.invalidate() + } + } + } else { + return .single(nil) + } +} + +protocol ConfirmPhoneNumberCodeController: class { + func applyCode(_ code: Int) +} + +private final class ConfirmPhoneNumberCodeControllerImpl: ItemListController, ConfirmPhoneNumberCodeController { + private let applyCodeImpl: (Int) -> Void + + init(account: Account, state: Signal<(ItemListControllerState, (ItemListNodeState, ConfirmPhoneNumberCodeEntry.ItemGenerationArguments)), NoError>, applyCodeImpl: @escaping (Int) -> Void) { + self.applyCodeImpl = applyCodeImpl + + let presentationData = account.telegramApplicationContext.currentPresentationData.with { $0 } + super.init(theme: presentationData.theme, strings: presentationData.strings, updatedPresentationData: account.telegramApplicationContext.presentationData |> map { ($0.theme, $0.strings) }, state: state, tabBarItem: nil) + } + + required init(coder aDecoder: NSCoder) { + fatalError("init(coder:) has not been implemented") + } + + func applyCode(_ code: Int) { + self.applyCodeImpl(code) + } +} + +func confirmPhoneNumberCodeController(account: Account, phoneNumber: String, codeData: CancelAccountResetData) -> ViewController { + let initialState = ConfirmPhoneNumberCodeControllerState(codeText: "", checking: false) + + let statePromise = ValuePromise(initialState, ignoreRepeated: true) + let stateValue = Atomic(value: initialState) + let updateState: ((ConfirmPhoneNumberCodeControllerState) -> ConfirmPhoneNumberCodeControllerState) -> Void = { f in + statePromise.set(stateValue.modify { f($0) }) + } + + var dismissImpl: (() -> Void)? + var presentControllerImpl: ((ViewController, Any?) -> Void)? + + let actionsDisposable = DisposableSet() + + let confirmPhoneDisposable = MetaDisposable() + actionsDisposable.add(confirmPhoneDisposable) + + let nextTypeDisposable = MetaDisposable() + actionsDisposable.add(nextTypeDisposable) + + let currentDataPromise = Promise() + currentDataPromise.set(.single(codeData)) + + let timeout = Promise() + timeout.set(currentDataPromise.get() + |> mapToSignal(timeoutSignal)) + + let resendCode = currentDataPromise.get() + |> mapToSignal { [weak currentDataPromise] data -> Signal in + if let _ = data.nextType { + return timeout.get() + |> filter { $0 == 0 } + |> take(1) + |> mapToSignal { _ -> Signal in + return Signal { subscriber in + return requestNextCancelAccountResetOption(network: account.network, phoneNumber: phoneNumber, phoneCodeHash: data.hash).start(next: { next in + currentDataPromise?.set(.single(next)) + }, error: { error in + + }) + } + } + } else { + return .complete() + } + } + nextTypeDisposable.set(resendCode.start()) + + let checkCode: () -> Void = { + var code: String? + updateState { state in + var state = state + if state.checking || state.codeText.isEmpty { + return state + } else { + code = state.codeText + state.checking = true + return state + } + } + if let code = code { + confirmPhoneDisposable.set((requestCancelAccountReset(network: account.network, phoneCodeHash: codeData.hash, phoneCode: code) + |> deliverOnMainQueue).start(error: { error in + updateState { state in + var state = state + state.checking = false + return state + } + let presentationData = account.telegramApplicationContext.currentPresentationData.with { $0 } + let alertText: String + switch error { + case .generic: + alertText = presentationData.strings.Login_UnknownError + case .invalidCode: + alertText = presentationData.strings.Login_InvalidCodeError + case .codeExpired: + alertText = presentationData.strings.Login_CodeExpiredError + case .limitExceeded: + alertText = presentationData.strings.Login_CodeFloodError + } + presentControllerImpl?(standardTextAlertController(theme: AlertControllerTheme(presentationTheme: presentationData.theme), title: nil, text: alertText, actions: [TextAlertAction(type: .defaultAction, title: presentationData.strings.Common_OK, action: {})]), ViewControllerPresentationArguments(presentationAnimation: .modalSheet)) + }, completed: { + updateState { state in + var state = state + state.checking = false + return state + } + let presentationData = account.telegramApplicationContext.currentPresentationData.with { $0 } + presentControllerImpl?(standardTextAlertController(theme: AlertControllerTheme(presentationTheme: presentationData.theme), title: nil, text: presentationData.strings.CancelResetAccount_Success(formatPhoneNumber(phoneNumber)).0, actions: [TextAlertAction(type: .defaultAction, title: presentationData.strings.Common_OK, action: {})]), nil) + dismissImpl?() + })) + } + } + + let arguments = ConfirmPhoneNumberCodeControllerArguments(updateEntryText: { updatedText in + var initiateCheck = false + updateState { state in + var state = state + if state.codeText.count < 5 && updatedText.count == 5 { + initiateCheck = true + } + state.codeText = updatedText + return state + } + if initiateCheck { + checkCode() + } + }, next: { + checkCode() + }) + + let signal = combineLatest((account.applicationContext as! TelegramApplicationContext).presentationData, statePromise.get() |> deliverOnMainQueue, currentDataPromise.get() |> deliverOnMainQueue, timeout.get() |> deliverOnMainQueue) + |> deliverOnMainQueue + |> map { presentationData, state, data, timeout -> (ItemListControllerState, (ItemListNodeState, ConfirmPhoneNumberCodeEntry.ItemGenerationArguments)) in + let leftNavigationButton = ItemListNavigationButton(content: .text(presentationData.strings.Common_Cancel), style: .regular, enabled: true, action: { + dismissImpl?() + }) + var rightNavigationButton: ItemListNavigationButton? + if state.checking { + rightNavigationButton = ItemListNavigationButton(content: .none, style: .activity, enabled: true, action: {}) + } else { + var nextEnabled = true + if state.codeText.isEmpty { + nextEnabled = false + } + rightNavigationButton = ItemListNavigationButton(content: .text(presentationData.strings.Common_Next), style: .bold, enabled: nextEnabled, action: { + checkCode() + }) + } + + let controllerState = ItemListControllerState(theme: presentationData.theme, title: .text(presentationData.strings.CancelResetAccount_Title), leftNavigationButton: leftNavigationButton, rightNavigationButton: rightNavigationButton, backNavigationButton: ItemListBackButton(title: presentationData.strings.Common_Back), animateChanges: false) + let listState = ItemListNodeState(entries: confirmPhoneNumberCodeControllerEntries(presentationData: presentationData, state: state, phoneNumber: phoneNumber, codeData: data, timeout: timeout, strings: presentationData.strings, theme: defaultLightAuthorizationTheme), style: .blocks, focusItemTag: ConfirmPhoneNumberCodeTag.input, emptyStateItem: nil, animateChanges: false) + + return (controllerState, (listState, arguments)) + } + |> afterDisposed { + actionsDisposable.dispose() + } + + let controller = ConfirmPhoneNumberCodeControllerImpl(account: account, state: signal, applyCodeImpl: { code in + updateState { state in + var state = state + state.codeText = "\(code)" + return state + } + checkCode() + }) + + presentControllerImpl = { [weak controller] c, p in + if let controller = controller { + controller.present(c, in: .window(.root), with: p) + } + } + dismissImpl = { [weak controller] in + controller?.dismiss() + } + + return controller +} diff --git a/TelegramUI/ContactAddItem.swift b/TelegramUI/ContactAddItem.swift index 72eb2ded4f..bf10ae93cd 100644 --- a/TelegramUI/ContactAddItem.swift +++ b/TelegramUI/ContactAddItem.swift @@ -24,7 +24,7 @@ class ContactsAddItem: ListViewItem { self.header = header } - func nodeConfiguredForParams(async: @escaping (@escaping () -> Void) -> Void, params: ListViewItemLayoutParams, synchronousLoads: Bool, previousItem: ListViewItem?, nextItem: ListViewItem?, completion: @escaping (ListViewItemNode, @escaping () -> (Signal?, () -> Void)) -> Void) { + func nodeConfiguredForParams(async: @escaping (@escaping () -> Void) -> Void, params: ListViewItemLayoutParams, synchronousLoads: Bool, previousItem: ListViewItem?, nextItem: ListViewItem?, completion: @escaping (ListViewItemNode, @escaping () -> (Signal?, (ListViewItemApply) -> Void)) -> Void) { async { let node = ContactsAddItemNode() let makeLayout = node.asyncLayout() @@ -34,12 +34,12 @@ class ContactsAddItem: ListViewItem { node.insets = nodeLayout.insets completion(node, { - return (nil, { nodeApply(false) }) + return (nil, { _ in nodeApply(false) }) }) } } - func updateNode(async: @escaping (@escaping () -> Void) -> Void, node: @escaping () -> ListViewItemNode, params: ListViewItemLayoutParams, previousItem: ListViewItem?, nextItem: ListViewItem?, animation: ListViewItemUpdateAnimation, completion: @escaping (ListViewItemNodeLayout, @escaping () -> Void) -> Void) { + func updateNode(async: @escaping (@escaping () -> Void) -> Void, node: @escaping () -> ListViewItemNode, params: ListViewItemLayoutParams, previousItem: ListViewItem?, nextItem: ListViewItem?, animation: ListViewItemUpdateAnimation, completion: @escaping (ListViewItemNodeLayout, @escaping (ListViewItemApply) -> Void) -> Void) { Queue.mainQueue().async { if let nodeValue = node() as? ContactsAddItemNode { let layout = nodeValue.asyncLayout() @@ -47,7 +47,7 @@ class ContactsAddItem: ListViewItem { let (first, last, firstWithHeader) = ContactsAddItem.mergeType(item: self, previousItem: previousItem, nextItem: nextItem) let (nodeLayout, apply) = layout(self, params, first, last, firstWithHeader) Queue.mainQueue().async { - completion(nodeLayout, { + completion(nodeLayout, { _ in apply(animation.isAnimated) }) } diff --git a/TelegramUI/ContactListActionItem.swift b/TelegramUI/ContactListActionItem.swift index 03735892ed..31bfa6923f 100644 --- a/TelegramUI/ContactListActionItem.swift +++ b/TelegramUI/ContactListActionItem.swift @@ -18,7 +18,7 @@ class ContactListActionItem: ListViewItem { self.action = action } - func nodeConfiguredForParams(async: @escaping (@escaping () -> Void) -> Void, params: ListViewItemLayoutParams, synchronousLoads: Bool, previousItem: ListViewItem?, nextItem: ListViewItem?, completion: @escaping (ListViewItemNode, @escaping () -> (Signal?, () -> Void)) -> Void) { + func nodeConfiguredForParams(async: @escaping (@escaping () -> Void) -> Void, params: ListViewItemLayoutParams, synchronousLoads: Bool, previousItem: ListViewItem?, nextItem: ListViewItem?, completion: @escaping (ListViewItemNode, @escaping () -> (Signal?, (ListViewItemApply) -> Void)) -> Void) { async { let node = ContactListActionItemNode() let (_, _, firstWithHeader) = ContactListActionItem.mergeType(item: self, previousItem: previousItem, nextItem: nextItem) @@ -29,13 +29,13 @@ class ContactListActionItem: ListViewItem { Queue.mainQueue().async { completion(node, { - return (nil, { apply() }) + return (nil, { _ in apply() }) }) } } } - func updateNode(async: @escaping (@escaping () -> Void) -> Void, node: @escaping () -> ListViewItemNode, params: ListViewItemLayoutParams, previousItem: ListViewItem?, nextItem: ListViewItem?, animation: ListViewItemUpdateAnimation, completion: @escaping (ListViewItemNodeLayout, @escaping () -> Void) -> Void) { + func updateNode(async: @escaping (@escaping () -> Void) -> Void, node: @escaping () -> ListViewItemNode, params: ListViewItemLayoutParams, previousItem: ListViewItem?, nextItem: ListViewItem?, animation: ListViewItemUpdateAnimation, completion: @escaping (ListViewItemNodeLayout, @escaping (ListViewItemApply) -> Void) -> Void) { Queue.mainQueue().async { if let nodeValue = node() as? ContactListActionItemNode { let makeLayout = nodeValue.asyncLayout() @@ -44,7 +44,7 @@ class ContactListActionItem: ListViewItem { let (_, _, firstWithHeader) = ContactListActionItem.mergeType(item: self, previousItem: previousItem, nextItem: nextItem) let (layout, apply) = makeLayout(self, params, firstWithHeader) Queue.mainQueue().async { - completion(layout, { + completion(layout, { _ in apply() }) } diff --git a/TelegramUI/ContactListNode.swift b/TelegramUI/ContactListNode.swift index 81a360cc25..5a9415556e 100644 --- a/TelegramUI/ContactListNode.swift +++ b/TelegramUI/ContactListNode.swift @@ -160,7 +160,7 @@ private enum ContactListNodeEntry: Comparable, Identifiable { interaction.activateSearch() }) case let .permissionInfo(theme, strings): - return PermissionInfoItem(theme: theme, strings: strings, subject: .contacts) + return PermissionInfoItem(theme: theme, strings: strings, subject: .contacts, type: .denied) case let .permissionEnable(theme, text): return ContactListActionItem(theme: theme, title: text, icon: nil, header: nil, action: { interaction.authorize() @@ -362,11 +362,11 @@ private func contactListNodeEntries(accountPeer: Peer?, peers: [ContactListPeer] switch authorizationStatus { case .denied: entries.append(.permissionInfo(theme, strings)) - entries.append(.permissionEnable(theme, strings.Permissions_ContactsAllowInSettings)) + entries.append(.permissionEnable(theme, strings.Permissions_ContactsAllowInSettings_v0)) addHeader = true case .notDetermined: entries.append(.permissionInfo(theme, strings)) - entries.append(.permissionEnable(theme, strings.Permissions_ContactsAllow)) + entries.append(.permissionEnable(theme, strings.Permissions_ContactsAllow_v0)) addHeader = true default: break @@ -654,7 +654,7 @@ final class ContactListNode: ASDisplayNode { var authorizeImpl: (() -> Void)? var openPrivacyPolicyImpl: (() -> Void)? - self.authorizationNode = PermissionContentNode(theme: self.presentationData.theme, strings: self.presentationData.strings, kind: .contacts, icon: UIImage(bundleImageName: "Settings/Permissions/Contacts"), title: self.presentationData.strings.Permissions_ContactsTitle, text: self.presentationData.strings.Permissions_ContactsText, buttonTitle: self.presentationData.strings.Contacts_PermissionsAllow, buttonAction: { + self.authorizationNode = PermissionContentNode(theme: self.presentationData.theme, strings: self.presentationData.strings, kind: .contacts, icon: UIImage(bundleImageName: "Settings/Permissions/Contacts"), title: self.presentationData.strings.Contacts_PermissionsTitle, text: self.presentationData.strings.Contacts_PermissionsText, buttonTitle: self.presentationData.strings.Contacts_PermissionsAllow, buttonAction: { authorizeImpl?() }, openPrivacyPolicy: { openPrivacyPolicyImpl?() @@ -664,7 +664,7 @@ final class ContactListNode: ASDisplayNode { super.init() self.backgroundColor = self.presentationData.theme.chatList.backgroundColor - //self.listNode.verticalScrollIndicatorColor = self.presentationData.theme.list.scrollIndicatorColor + self.listNode.verticalScrollIndicatorColor = self.presentationData.theme.list.scrollIndicatorColor self.selectionStateValue = selectionState self.selectionStatePromise.set(.single(selectionState)) @@ -875,7 +875,7 @@ final class ContactListNode: ASDisplayNode { let authorizationPreviousHidden = strongSelf.authorizationNode.isHidden strongSelf.authorizationNode.removeFromSupernode() - strongSelf.authorizationNode = PermissionContentNode(theme: strongSelf.presentationData.theme, strings: strongSelf.presentationData.strings, kind: .contacts, icon: UIImage(bundleImageName: "Settings/Permissions/Contacts"), title: strongSelf.presentationData.strings.Permissions_ContactsTitle, text: strongSelf.presentationData.strings.Permissions_ContactsText, buttonTitle: strongSelf.presentationData.strings.Contacts_PermissionsAllow, buttonAction: { + strongSelf.authorizationNode = PermissionContentNode(theme: strongSelf.presentationData.theme, strings: strongSelf.presentationData.strings, kind: .contacts, icon: UIImage(bundleImageName: "Settings/Permissions/Contacts"), title: strongSelf.presentationData.strings.Contacts_PermissionsTitle, text: strongSelf.presentationData.strings.Contacts_PermissionsText, buttonTitle: strongSelf.presentationData.strings.Contacts_PermissionsAllow, buttonAction: { authorizeImpl?() }, openPrivacyPolicy: { openPrivacyPolicyImpl?() diff --git a/TelegramUI/ContactsPeerItem.swift b/TelegramUI/ContactsPeerItem.swift index 5279de07df..f1e4acff77 100644 --- a/TelegramUI/ContactsPeerItem.swift +++ b/TelegramUI/ContactsPeerItem.swift @@ -195,7 +195,7 @@ class ContactsPeerItem: ListViewItem { } } - func nodeConfiguredForParams(async: @escaping (@escaping () -> Void) -> Void, params: ListViewItemLayoutParams, synchronousLoads: Bool, previousItem: ListViewItem?, nextItem: ListViewItem?, completion: @escaping (ListViewItemNode, @escaping () -> (Signal?, () -> Void)) -> Void) { + func nodeConfiguredForParams(async: @escaping (@escaping () -> Void) -> Void, params: ListViewItemLayoutParams, synchronousLoads: Bool, previousItem: ListViewItem?, nextItem: ListViewItem?, completion: @escaping (ListViewItemNode, @escaping () -> (Signal?, (ListViewItemApply) -> Void)) -> Void) { async { let node = ContactsPeerItemNode() let makeLayout = node.asyncLayout() @@ -207,7 +207,7 @@ class ContactsPeerItem: ListViewItem { Queue.mainQueue().async { completion(node, { let (signal, apply) = nodeApply() - return (signal, { + return (signal, { _ in apply(false, synchronousLoads) }) }) @@ -215,7 +215,7 @@ class ContactsPeerItem: ListViewItem { } } - func updateNode(async: @escaping (@escaping () -> Void) -> Void, node: @escaping () -> ListViewItemNode, params: ListViewItemLayoutParams, previousItem: ListViewItem?, nextItem: ListViewItem?, animation: ListViewItemUpdateAnimation, completion: @escaping (ListViewItemNodeLayout, @escaping () -> Void) -> Void) { + func updateNode(async: @escaping (@escaping () -> Void) -> Void, node: @escaping () -> ListViewItemNode, params: ListViewItemLayoutParams, previousItem: ListViewItem?, nextItem: ListViewItem?, animation: ListViewItemUpdateAnimation, completion: @escaping (ListViewItemNodeLayout, @escaping (ListViewItemApply) -> Void) -> Void) { Queue.mainQueue().async { if let nodeValue = node() as? ContactsPeerItemNode { let layout = nodeValue.asyncLayout() @@ -223,7 +223,7 @@ class ContactsPeerItem: ListViewItem { let (first, last, firstWithHeader) = ContactsPeerItem.mergeType(item: self, previousItem: previousItem, nextItem: nextItem) let (nodeLayout, apply) = layout(self, params, first, last, firstWithHeader) Queue.mainQueue().async { - completion(nodeLayout, { + completion(nodeLayout, { _ in apply().1(animation.isAnimated, false) }) } diff --git a/TelegramUI/DebugController.swift b/TelegramUI/DebugController.swift index 22c2520c3f..70ec43d60c 100644 --- a/TelegramUI/DebugController.swift +++ b/TelegramUI/DebugController.swift @@ -40,6 +40,9 @@ private enum DebugControllerEntry: ItemListNodeEntry { case keepChatNavigationStack(PresentationTheme, Bool) case clearTips(PresentationTheme) case reimport(PresentationTheme) + case sendTthumb(PresentationTheme) + case previewTthumb(PresentationTheme) + case animatedStickers(PresentationTheme) case versionInfo(PresentationTheme) var section: ItemListSectionId { @@ -54,7 +57,7 @@ private enum DebugControllerEntry: ItemListNodeEntry { return DebugControllerSection.logging.rawValue case .enableRaiseToSpeak, .keepChatNavigationStack: return DebugControllerSection.experiments.rawValue - case .clearTips, .reimport: + case .clearTips, .reimport, .sendTthumb, .previewTthumb, .animatedStickers: return DebugControllerSection.experiments.rawValue case .versionInfo: return DebugControllerSection.info.rawValue @@ -87,8 +90,14 @@ private enum DebugControllerEntry: ItemListNodeEntry { return 10 case .reimport: return 11 - case .versionInfo: + case .sendTthumb: return 12 + case .previewTthumb: + return 13 + case .animatedStickers: + return 14 + case .versionInfo: + return 15 } } @@ -205,6 +214,18 @@ private enum DebugControllerEntry: ItemListNodeEntry { exit(0) } }) + case let .sendTthumb(theme): + return ItemListSwitchItem(theme: theme, title: "Send TThumb", value: GlobalExperimentalSettings.enableTinyThumbnails, sectionId: self.section, style: .blocks, updated: { value in + GlobalExperimentalSettings.enableTinyThumbnails = value + }) + case let .previewTthumb(theme): + return ItemListSwitchItem(theme: theme, title: "Preview TThumb", value: GlobalExperimentalSettings.forceTinyThumbnailsPreview, sectionId: self.section, style: .blocks, updated: { value in + GlobalExperimentalSettings.forceTinyThumbnailsPreview = value + }) + case let .animatedStickers(theme): + return ItemListSwitchItem(theme: theme, title: "Animated Stickers", value: GlobalExperimentalSettings.animatedStickers, sectionId: self.section, style: .blocks, updated: { value in + GlobalExperimentalSettings.animatedStickers = value + }) case let .versionInfo(theme): let bundle = Bundle.main let bundleId = bundle.bundleIdentifier ?? "" @@ -235,6 +256,9 @@ private func debugControllerEntries(presentationData: PresentationData, loggingS if hasLegacyAppData { entries.append(.reimport(presentationData.theme)) } + entries.append(.sendTthumb(presentationData.theme)) + entries.append(.previewTthumb(presentationData.theme)) + entries.append(.animatedStickers(presentationData.theme)) entries.append(.versionInfo(presentationData.theme)) return entries diff --git a/TelegramUI/EditSettingsController.swift b/TelegramUI/EditSettingsController.swift index 351d3f5953..cbb9249a4b 100644 --- a/TelegramUI/EditSettingsController.swift +++ b/TelegramUI/EditSettingsController.swift @@ -444,7 +444,7 @@ func editSettingsController(account: Account, currentName: ItemListAvatarAndName hasPhotos = true } - let mixin = TGMediaAvatarMenuMixin(context: legacyController.context, parentController: emptyController, hasDeleteButton: hasPhotos, personalPhoto: true, saveEditedPhotos: false, saveCapturedMedia: false)! + let mixin = TGMediaAvatarMenuMixin(context: legacyController.context, parentController: emptyController, hasDeleteButton: hasPhotos, hasViewButton: hasPhotos, personalPhoto: true, saveEditedPhotos: false, saveCapturedMedia: false, signup: false)! let _ = currentAvatarMixin.swap(mixin) mixin.didFinishWithImage = { image in if let image = image { @@ -457,12 +457,12 @@ func editSettingsController(account: Account, currentName: ItemListAvatarAndName } updateAvatarDisposable.set((updateAccountPhoto(account: account, resource: resource) |> deliverOnMainQueue).start(next: { result in switch result { - case .complete: - updateState { - $0.withUpdatedUpdatingAvatar(nil) - } - case .progress: - break + case .complete: + updateState { + $0.withUpdatedUpdatingAvatar(nil) + } + case .progress: + break } })) } @@ -488,6 +488,27 @@ func editSettingsController(account: Account, currentName: ItemListAvatarAndName } })) } + mixin.didFinishWithView = { + let _ = currentAvatarMixin.swap(nil) + + let _ = (account.postbox.loadedPeerWithId(account.peerId) + |> take(1) + |> deliverOnMainQueue).start(next: { peer in + if peer.smallProfileImage != nil { + let galleryController = AvatarGalleryController(account: account, peer: peer, replaceRootController: { controller, ready in + }) + /*hiddenAvatarRepresentationDisposable.set((galleryController.hiddenMedia |> deliverOnMainQueue).start(next: { entry in + avatarAndNameInfoContext.hiddenAvatarRepresentation = entry?.representations.first + updateHiddenAvatarImpl?() + }))*/ + presentControllerImpl?(galleryController, AvatarGalleryControllerPresentationArguments(transitionArguments: { entry in + return nil + })) + } else { + changeProfilePhotoImpl?() + } + }) + } mixin.didDismiss = { [weak legacyController] in let _ = currentAvatarMixin.swap(nil) legacyController?.dismiss() diff --git a/TelegramUI/EmojisChatInputPanelItem.swift b/TelegramUI/EmojisChatInputPanelItem.swift index 8cee508e0f..0550463d26 100644 --- a/TelegramUI/EmojisChatInputPanelItem.swift +++ b/TelegramUI/EmojisChatInputPanelItem.swift @@ -20,7 +20,7 @@ final class EmojisChatInputPanelItem: ListViewItem { self.hashtagSelected = hashtagSelected } - public func nodeConfiguredForParams(async: @escaping (@escaping () -> Void) -> Void, params: ListViewItemLayoutParams, synchronousLoads: Bool, previousItem: ListViewItem?, nextItem: ListViewItem?, completion: @escaping (ListViewItemNode, @escaping () -> (Signal?, () -> Void)) -> Void) { + public func nodeConfiguredForParams(async: @escaping (@escaping () -> Void) -> Void, params: ListViewItemLayoutParams, synchronousLoads: Bool, previousItem: ListViewItem?, nextItem: ListViewItem?, completion: @escaping (ListViewItemNode, @escaping () -> (Signal?, (ListViewItemApply) -> Void)) -> Void) { let configure = { () -> Void in let node = EmojisChatInputPanelItemNode() @@ -33,7 +33,7 @@ final class EmojisChatInputPanelItem: ListViewItem { Queue.mainQueue().async { completion(node, { - return (nil, { apply(.None) }) + return (nil, { _ in apply(.None) }) }) } } @@ -46,7 +46,7 @@ final class EmojisChatInputPanelItem: ListViewItem { } } - public func updateNode(async: @escaping (@escaping () -> Void) -> Void, node: @escaping () -> ListViewItemNode, params: ListViewItemLayoutParams, previousItem: ListViewItem?, nextItem: ListViewItem?, animation: ListViewItemUpdateAnimation, completion: @escaping (ListViewItemNodeLayout, @escaping () -> Void) -> Void) { + public func updateNode(async: @escaping (@escaping () -> Void) -> Void, node: @escaping () -> ListViewItemNode, params: ListViewItemLayoutParams, previousItem: ListViewItem?, nextItem: ListViewItem?, animation: ListViewItemUpdateAnimation, completion: @escaping (ListViewItemNodeLayout, @escaping (ListViewItemApply) -> Void) -> Void) { Queue.mainQueue().async { if let nodeValue = node() as? EmojisChatInputPanelItemNode { let nodeLayout = nodeValue.asyncLayout() @@ -56,7 +56,7 @@ final class EmojisChatInputPanelItem: ListViewItem { let (layout, apply) = nodeLayout(self, params, top, bottom) Queue.mainQueue().async { - completion(layout, { + completion(layout, { _ in apply(animation) }) } diff --git a/TelegramUI/ExternalMusicAlbumArtResources.swift b/TelegramUI/ExternalMusicAlbumArtResources.swift index dd8514fc8a..9a78302558 100644 --- a/TelegramUI/ExternalMusicAlbumArtResources.swift +++ b/TelegramUI/ExternalMusicAlbumArtResources.swift @@ -52,7 +52,7 @@ public class ExternalMusicAlbumArtResource: TelegramMediaResource { return ExternalMusicAlbumArtResourceId(title: self.title, performer: self.performer, isThumbnail: self.isThumbnail) } - public func isEqual(to: TelegramMediaResource) -> Bool { + public func isEqual(to: MediaResource) -> Bool { if let to = to as? ExternalMusicAlbumArtResource { return self.title == to.title && self.performer == to.performer && self.isThumbnail == to.isThumbnail } else { @@ -61,7 +61,7 @@ public class ExternalMusicAlbumArtResource: TelegramMediaResource { } } -private func urlEncodedStringFromString(_ string: String) -> String { +func urlEncodedStringFromString(_ string: String) -> String { var nsString: NSString = string as NSString if let value = nsString.replacingPercentEscapes(using: String.Encoding.utf8.rawValue) { nsString = value as NSString diff --git a/TelegramUI/FetchPhotoLibraryImageResource.swift b/TelegramUI/FetchPhotoLibraryImageResource.swift index 9fcc47bde1..02ea935999 100644 --- a/TelegramUI/FetchPhotoLibraryImageResource.swift +++ b/TelegramUI/FetchPhotoLibraryImageResource.swift @@ -50,7 +50,19 @@ func fetchPhotoLibraryResource(localIdentifier: String) -> Signal map { resourceStatus, pendingStatus, playbackStatus -> FileMediaResourceStatus in let mediaStatus: FileMediaResourceMediaStatus diff --git a/TelegramUI/GlobalExperimentalSettings.swift b/TelegramUI/GlobalExperimentalSettings.swift index 143bfa6a53..4df6dd8ba0 100644 --- a/TelegramUI/GlobalExperimentalSettings.swift +++ b/TelegramUI/GlobalExperimentalSettings.swift @@ -3,4 +3,7 @@ import Foundation public struct GlobalExperimentalSettings { public static var isAppStoreBuild: Bool = false public static var enableFeed: Bool = false + public static var enableTinyThumbnails: Bool = false + public static var forceTinyThumbnailsPreview: Bool = false + public static var animatedStickers: Bool = false } diff --git a/TelegramUI/GroupInfoController.swift b/TelegramUI/GroupInfoController.swift index f7e338b4d9..c68a6e4371 100644 --- a/TelegramUI/GroupInfoController.swift +++ b/TelegramUI/GroupInfoController.swift @@ -1088,11 +1088,15 @@ private func groupInfoEntries(account: Account, presentationData: PresentationDa if case .creator = group.role, state.editingState != nil { entries.append(.convertToSupergroup(presentationData.theme, presentationData.strings.GroupInfo_ConvertToSupergroup)) } - entries.append(.leave(presentationData.theme, presentationData.strings.GroupInfo_DeleteAndExit)) + if case .creator = group.role { + entries.append(.leave(presentationData.theme, presentationData.strings.GroupInfo_DeleteAndExit)) + } else { + entries.append(.leave(presentationData.theme, presentationData.strings.Group_LeaveGroup)) + } } } else if let channel = view.peers[view.peerId] as? TelegramChannel { if case .member = channel.participationStatus, let cachedChannelData = view.cachedData as? CachedChannelData, let memberCount = cachedChannelData.participantsSummary.memberCount, memberCount <= 200 { - entries.append(.leave(presentationData.theme, presentationData.strings.GroupInfo_DeleteAndExit)) + entries.append(.leave(presentationData.theme, presentationData.strings.Group_LeaveGroup)) } } @@ -1192,7 +1196,7 @@ public func groupInfoController(account: Account, peerId: PeerId) -> ViewControl }) hiddenAvatarRepresentationDisposable.set((galleryController.hiddenMedia |> deliverOnMainQueue).start(next: { entry in - avatarAndNameInfoContext.hiddenAvatarRepresentation = entry?.representations.first + avatarAndNameInfoContext.hiddenAvatarRepresentation = entry?.representations.first?.representation updateHiddenAvatarImpl?() })) presentControllerImpl?(galleryController, AvatarGalleryControllerPresentationArguments(transitionArguments: { entry in @@ -1674,123 +1678,144 @@ public func groupInfoController(account: Account, peerId: PeerId) -> ViewControl channelMembersPromise.set(.single([])) } - let previousChannelMemberCount = Atomic(value: nil) + let previousChannelMembers = Atomic<[PeerId]?>(value: nil) let globalNotificationsKey: PostboxViewKey = .preferences(keys: Set([PreferencesKeys.globalNotifications])) let signal = combineLatest((account.applicationContext as! TelegramApplicationContext).presentationData, statePromise.get(), account.viewTracker.peerView(peerId), account.postbox.combinedView(keys: [globalNotificationsKey]), channelMembersPromise.get()) - |> map { presentationData, state, view, combinedView, channelMembers -> (ItemListControllerState, (ItemListNodeState, GroupInfoEntry.ItemGenerationArguments)) in - let peer = peerViewMainPeer(view) - - var globalNotificationSettings: GlobalNotificationSettings = GlobalNotificationSettings.defaultSettings - if let preferencesView = combinedView.views[globalNotificationsKey] as? PreferencesView { - if let settings = preferencesView.values[PreferencesKeys.globalNotifications] as? GlobalNotificationSettings { - globalNotificationSettings = settings - } + |> map { presentationData, state, view, combinedView, channelMembers -> (ItemListControllerState, (ItemListNodeState, GroupInfoEntry.ItemGenerationArguments)) in + let peer = peerViewMainPeer(view) + + var globalNotificationSettings: GlobalNotificationSettings = GlobalNotificationSettings.defaultSettings + if let preferencesView = combinedView.views[globalNotificationsKey] as? PreferencesView { + if let settings = preferencesView.values[PreferencesKeys.globalNotifications] as? GlobalNotificationSettings { + globalNotificationSettings = settings } - - let rightNavigationButton: ItemListNavigationButton - var secondaryRightNavigationButton: ItemListNavigationButton? - if let editingState = state.editingState { - var doneEnabled = true - if let editingName = editingState.editingName, editingName.isEmpty { + } + + let rightNavigationButton: ItemListNavigationButton + var secondaryRightNavigationButton: ItemListNavigationButton? + if let editingState = state.editingState { + var doneEnabled = true + if let editingName = editingState.editingName, editingName.isEmpty { + doneEnabled = false + } + if peer is TelegramChannel { + if (view.cachedData as? CachedChannelData) == nil { doneEnabled = false } - if peer is TelegramChannel { - if (view.cachedData as? CachedChannelData) == nil { - doneEnabled = false - } - } - - if state.savingData { - rightNavigationButton = ItemListNavigationButton(content: .none, style: .activity, enabled: doneEnabled, action: {}) - } else { - rightNavigationButton = ItemListNavigationButton(content: .text(presentationData.strings.Common_Done), style: .bold, enabled: doneEnabled, action: { - var updateValues: (title: String?, description: String?) = (nil, nil) - updateState { state in - updateValues = valuesRequiringUpdate(state: state, view: view) - if updateValues.0 != nil || updateValues.1 != nil { - return state.withUpdatedSavingData(true) - } else { - return state.withUpdatedEditingState(nil) - } - } - - let updateTitle: Signal - if let titleValue = updateValues.title { - updateTitle = updatePeerTitle(account: account, peerId: peerId, title: titleValue) - |> mapError { _ in return Void() } - } else { - updateTitle = .complete() - } - - let updateDescription: Signal - if let descriptionValue = updateValues.description { - updateDescription = updatePeerDescription(account: account, peerId: peerId, description: descriptionValue.isEmpty ? nil : descriptionValue) - |> mapError { _ in return Void() } - } else { - updateDescription = .complete() - } - - let signal = combineLatest(updateTitle, updateDescription) - - updatePeerNameDisposable.set((signal |> deliverOnMainQueue).start(error: { _ in - updateState { state in - return state.withUpdatedSavingData(false) - } - }, completed: { - updateState { state in - return state.withUpdatedSavingData(false).withUpdatedEditingState(nil) - } - })) - }) - } + } + + if state.savingData { + rightNavigationButton = ItemListNavigationButton(content: .none, style: .activity, enabled: doneEnabled, action: {}) } else { - rightNavigationButton = ItemListNavigationButton(content: .text(presentationData.strings.Common_Edit), style: .regular, enabled: true, action: { - if let peer = peer as? TelegramGroup { - updateState { state in - return state.withUpdatedEditingState(GroupInfoEditingState(editingName: ItemListAvatarAndNameInfoItemName(peer), editingDescriptionText: "")) - } - } else if let channel = peer as? TelegramChannel, case .group = channel.info { - var text = "" - if let cachedData = view.cachedData as? CachedChannelData, let about = cachedData.about { - text = about - } - updateState { state in - return state.withUpdatedEditingState(GroupInfoEditingState(editingName: ItemListAvatarAndNameInfoItemName(channel), editingDescriptionText: text)) - } - } - }) - if peer is TelegramChannel { - secondaryRightNavigationButton = ItemListNavigationButton(content: .icon(.search), style: .regular, enabled: true, action: { - updateState { state in - return state.withUpdatedSearchingMembers(true) - } - }) - } - - } - - var searchItem: ItemListControllerSearch? - if state.searchingMembers { - searchItem = ChannelMembersSearchItem(account: account, peerId: peerId, cancel: { + rightNavigationButton = ItemListNavigationButton(content: .text(presentationData.strings.Common_Done), style: .bold, enabled: doneEnabled, action: { + var updateValues: (title: String?, description: String?) = (nil, nil) updateState { state in - return state.withUpdatedSearchingMembers(false) + updateValues = valuesRequiringUpdate(state: state, view: view) + if updateValues.0 != nil || updateValues.1 != nil { + return state.withUpdatedSavingData(true) + } else { + return state.withUpdatedEditingState(nil) + } } - }, openPeer: { peer, _ in - if let infoController = peerInfoController(account: account, peer: peer) { - arguments.pushController(infoController) + + let updateTitle: Signal + if let titleValue = updateValues.title { + updateTitle = updatePeerTitle(account: account, peerId: peerId, title: titleValue) + |> mapError { _ in return Void() } + } else { + updateTitle = .complete() + } + + let updateDescription: Signal + if let descriptionValue = updateValues.description { + updateDescription = updatePeerDescription(account: account, peerId: peerId, description: descriptionValue.isEmpty ? nil : descriptionValue) + |> mapError { _ in return Void() } + } else { + updateDescription = .complete() + } + + let signal = combineLatest(updateTitle, updateDescription) + + updatePeerNameDisposable.set((signal |> deliverOnMainQueue).start(error: { _ in + updateState { state in + return state.withUpdatedSavingData(false) + } + }, completed: { + updateState { state in + return state.withUpdatedSavingData(false).withUpdatedEditingState(nil) + } + })) + }) + } + } else { + rightNavigationButton = ItemListNavigationButton(content: .text(presentationData.strings.Common_Edit), style: .regular, enabled: true, action: { + if let peer = peer as? TelegramGroup { + updateState { state in + return state.withUpdatedEditingState(GroupInfoEditingState(editingName: ItemListAvatarAndNameInfoItemName(peer), editingDescriptionText: "")) + } + } else if let channel = peer as? TelegramChannel, case .group = channel.info { + var text = "" + if let cachedData = view.cachedData as? CachedChannelData, let about = cachedData.about { + text = about + } + updateState { state in + return state.withUpdatedEditingState(GroupInfoEditingState(editingName: ItemListAvatarAndNameInfoItemName(channel), editingDescriptionText: text)) + } + } + }) + if peer is TelegramChannel { + secondaryRightNavigationButton = ItemListNavigationButton(content: .icon(.search), style: .regular, enabled: true, action: { + updateState { state in + return state.withUpdatedSearchingMembers(true) } }) } - let controllerState = ItemListControllerState(theme: presentationData.theme, title: .text(presentationData.strings.GroupInfo_Title), leftNavigationButton: nil, rightNavigationButton: rightNavigationButton, secondaryRightNavigationButton: secondaryRightNavigationButton, backNavigationButton: ItemListBackButton(title: presentationData.strings.Common_Back)) - let previousCount = previousChannelMemberCount.swap(channelMembers.count) ?? 0 - let listState = ItemListNodeState(entries: groupInfoEntries(account: account, presentationData: presentationData, view: view, channelMembers: channelMembers, globalNotificationSettings: globalNotificationSettings, state: state), style: .blocks, searchItem: searchItem, animateChanges: previousCount >= channelMembers.count) - - return (controllerState, (listState, arguments)) - } |> afterDisposed { - actionsDisposable.dispose() } + + var searchItem: ItemListControllerSearch? + if state.searchingMembers { + searchItem = ChannelMembersSearchItem(account: account, peerId: peerId, cancel: { + updateState { state in + return state.withUpdatedSearchingMembers(false) + } + }, openPeer: { peer, _ in + if let infoController = peerInfoController(account: account, peer: peer) { + arguments.pushController(infoController) + } + }) + } + + let controllerState = ItemListControllerState(theme: presentationData.theme, title: .text(presentationData.strings.GroupInfo_Title), leftNavigationButton: nil, rightNavigationButton: rightNavigationButton, secondaryRightNavigationButton: secondaryRightNavigationButton, backNavigationButton: ItemListBackButton(title: presentationData.strings.Common_Back)) + + let entries = groupInfoEntries(account: account, presentationData: presentationData, view: view, channelMembers: channelMembers, globalNotificationSettings: globalNotificationSettings, state: state) + var memberIds: [PeerId] = [] + for entry in entries { + switch entry { + case let .member(member): + memberIds.append(member.peerId) + default: + break + } + } + + let previousMembers = previousChannelMembers.swap(memberIds) ?? [] + + var animateChanges = previousMembers.count >= memberIds.count + if presentationData.disableAnimations { + if Set(memberIds) == Set(previousMembers) && memberIds != previousMembers { + animateChanges = false + } + } + + let listState = ItemListNodeState(entries: entries, style: .blocks, searchItem: searchItem, animateChanges: animateChanges) + + return (controllerState, (listState, arguments)) + } + |> afterDisposed { + actionsDisposable.dispose() + } let controller = ItemListController(account: account, state: signal) diff --git a/TelegramUI/GroupStickerPackCurrentItem.swift b/TelegramUI/GroupStickerPackCurrentItem.swift index cfffb7b949..a6d0ddec17 100644 --- a/TelegramUI/GroupStickerPackCurrentItem.swift +++ b/TelegramUI/GroupStickerPackCurrentItem.swift @@ -28,7 +28,7 @@ final class GroupStickerPackCurrentItem: ListViewItem, ItemListItem { self.action = action } - func nodeConfiguredForParams(async: @escaping (@escaping () -> Void) -> Void, params: ListViewItemLayoutParams, synchronousLoads: Bool, previousItem: ListViewItem?, nextItem: ListViewItem?, completion: @escaping (ListViewItemNode, @escaping () -> (Signal?, () -> Void)) -> Void) { + func nodeConfiguredForParams(async: @escaping (@escaping () -> Void) -> Void, params: ListViewItemLayoutParams, synchronousLoads: Bool, previousItem: ListViewItem?, nextItem: ListViewItem?, completion: @escaping (ListViewItemNode, @escaping () -> (Signal?, (ListViewItemApply) -> Void)) -> Void) { async { let node = GroupStickerPackCurrentItemNode() let (layout, apply) = node.asyncLayout()(self, params, itemListNeighbors(item: self, topItem: previousItem as? ItemListItem, bottomItem: nextItem as? ItemListItem)) @@ -38,13 +38,13 @@ final class GroupStickerPackCurrentItem: ListViewItem, ItemListItem { Queue.mainQueue().async { completion(node, { - return (nil, { apply(false) }) + return (nil, { _ in apply(false) }) }) } } } - func updateNode(async: @escaping (@escaping () -> Void) -> Void, node: @escaping () -> ListViewItemNode, params: ListViewItemLayoutParams, previousItem: ListViewItem?, nextItem: ListViewItem?, animation: ListViewItemUpdateAnimation, completion: @escaping (ListViewItemNodeLayout, @escaping () -> Void) -> Void) { + func updateNode(async: @escaping (@escaping () -> Void) -> Void, node: @escaping () -> ListViewItemNode, params: ListViewItemLayoutParams, previousItem: ListViewItem?, nextItem: ListViewItem?, animation: ListViewItemUpdateAnimation, completion: @escaping (ListViewItemNodeLayout, @escaping (ListViewItemApply) -> Void) -> Void) { Queue.mainQueue().async { if let nodeValue = node() as? GroupStickerPackCurrentItemNode { let makeLayout = nodeValue.asyncLayout() @@ -57,7 +57,7 @@ final class GroupStickerPackCurrentItem: ListViewItem, ItemListItem { async { let (layout, apply) = makeLayout(self, params, itemListNeighbors(item: self, topItem: previousItem as? ItemListItem, bottomItem: nextItem as? ItemListItem)) Queue.mainQueue().async { - completion(layout, { + completion(layout, { _ in apply(animated) }) } diff --git a/TelegramUI/HashtagChatInputPanelItem.swift b/TelegramUI/HashtagChatInputPanelItem.swift index f9c525a48c..e9b1a08c1e 100644 --- a/TelegramUI/HashtagChatInputPanelItem.swift +++ b/TelegramUI/HashtagChatInputPanelItem.swift @@ -18,7 +18,7 @@ final class HashtagChatInputPanelItem: ListViewItem { self.hashtagSelected = hashtagSelected } - public func nodeConfiguredForParams(async: @escaping (@escaping () -> Void) -> Void, params: ListViewItemLayoutParams, synchronousLoads: Bool, previousItem: ListViewItem?, nextItem: ListViewItem?, completion: @escaping (ListViewItemNode, @escaping () -> (Signal?, () -> Void)) -> Void) { + public func nodeConfiguredForParams(async: @escaping (@escaping () -> Void) -> Void, params: ListViewItemLayoutParams, synchronousLoads: Bool, previousItem: ListViewItem?, nextItem: ListViewItem?, completion: @escaping (ListViewItemNode, @escaping () -> (Signal?, (ListViewItemApply) -> Void)) -> Void) { let configure = { () -> Void in let node = HashtagChatInputPanelItemNode() @@ -31,7 +31,7 @@ final class HashtagChatInputPanelItem: ListViewItem { Queue.mainQueue().async { completion(node, { - return (nil, { apply(.None) }) + return (nil, { _ in apply(.None) }) }) } } @@ -44,7 +44,7 @@ final class HashtagChatInputPanelItem: ListViewItem { } } - public func updateNode(async: @escaping (@escaping () -> Void) -> Void, node: @escaping () -> ListViewItemNode, params: ListViewItemLayoutParams, previousItem: ListViewItem?, nextItem: ListViewItem?, animation: ListViewItemUpdateAnimation, completion: @escaping (ListViewItemNodeLayout, @escaping () -> Void) -> Void) { + public func updateNode(async: @escaping (@escaping () -> Void) -> Void, node: @escaping () -> ListViewItemNode, params: ListViewItemLayoutParams, previousItem: ListViewItem?, nextItem: ListViewItem?, animation: ListViewItemUpdateAnimation, completion: @escaping (ListViewItemNodeLayout, @escaping (ListViewItemApply) -> Void) -> Void) { Queue.mainQueue().async { if let nodeValue = node() as? HashtagChatInputPanelItemNode { let nodeLayout = nodeValue.asyncLayout() @@ -54,7 +54,7 @@ final class HashtagChatInputPanelItem: ListViewItem { let (layout, apply) = nodeLayout(self, params, top, bottom) Queue.mainQueue().async { - completion(layout, { + completion(layout, { _ in apply(animation) }) } diff --git a/TelegramUI/HorizontalListContextResultsChatInputPanelItem.swift b/TelegramUI/HorizontalListContextResultsChatInputPanelItem.swift index 1a646c4a17..a4be920a85 100644 --- a/TelegramUI/HorizontalListContextResultsChatInputPanelItem.swift +++ b/TelegramUI/HorizontalListContextResultsChatInputPanelItem.swift @@ -19,7 +19,7 @@ final class HorizontalListContextResultsChatInputPanelItem: ListViewItem { self.resultSelected = resultSelected } - public func nodeConfiguredForParams(async: @escaping (@escaping () -> Void) -> Void, params: ListViewItemLayoutParams, synchronousLoads: Bool, previousItem: ListViewItem?, nextItem: ListViewItem?, completion: @escaping (ListViewItemNode, @escaping () -> (Signal?, () -> Void)) -> Void) { + public func nodeConfiguredForParams(async: @escaping (@escaping () -> Void) -> Void, params: ListViewItemLayoutParams, synchronousLoads: Bool, previousItem: ListViewItem?, nextItem: ListViewItem?, completion: @escaping (ListViewItemNode, @escaping () -> (Signal?, (ListViewItemApply) -> Void)) -> Void) { let configure = { () -> Void in let node = HorizontalListContextResultsChatInputPanelItemNode() @@ -32,7 +32,7 @@ final class HorizontalListContextResultsChatInputPanelItem: ListViewItem { Queue.mainQueue().async { completion(node, { - return (nil, { apply(.None) }) + return (nil, { _ in apply(.None) }) }) } } @@ -45,7 +45,7 @@ final class HorizontalListContextResultsChatInputPanelItem: ListViewItem { } } - public func updateNode(async: @escaping (@escaping () -> Void) -> Void, node: @escaping () -> ListViewItemNode, params: ListViewItemLayoutParams, previousItem: ListViewItem?, nextItem: ListViewItem?, animation: ListViewItemUpdateAnimation, completion: @escaping (ListViewItemNodeLayout, @escaping () -> Void) -> Void) { + public func updateNode(async: @escaping (@escaping () -> Void) -> Void, node: @escaping () -> ListViewItemNode, params: ListViewItemLayoutParams, previousItem: ListViewItem?, nextItem: ListViewItem?, animation: ListViewItemUpdateAnimation, completion: @escaping (ListViewItemNodeLayout, @escaping (ListViewItemApply) -> Void) -> Void) { Queue.mainQueue().async { if let nodeValue = node() as? HorizontalListContextResultsChatInputPanelItemNode { let nodeLayout = nodeValue.asyncLayout() @@ -55,7 +55,7 @@ final class HorizontalListContextResultsChatInputPanelItem: ListViewItem { let (layout, apply) = nodeLayout(self, params, top, bottom) Queue.mainQueue().async { - completion(layout, { + completion(layout, { _ in apply(animation) }) } diff --git a/TelegramUI/HorizontalPeerItem.swift b/TelegramUI/HorizontalPeerItem.swift index c3c6f50c32..92fc5c223a 100644 --- a/TelegramUI/HorizontalPeerItem.swift +++ b/TelegramUI/HorizontalPeerItem.swift @@ -36,7 +36,7 @@ final class HorizontalPeerItem: ListViewItem { self.unreadBadge = unreadBadge } - func nodeConfiguredForParams(async: @escaping (@escaping () -> Void) -> Void, params: ListViewItemLayoutParams, synchronousLoads: Bool, previousItem: ListViewItem?, nextItem: ListViewItem?, completion: @escaping (ListViewItemNode, @escaping () -> (Signal?, () -> Void)) -> Void) { + func nodeConfiguredForParams(async: @escaping (@escaping () -> Void) -> Void, params: ListViewItemLayoutParams, synchronousLoads: Bool, previousItem: ListViewItem?, nextItem: ListViewItem?, completion: @escaping (ListViewItemNode, @escaping () -> (Signal?, (ListViewItemApply) -> Void)) -> Void) { async { let node = HorizontalPeerItemNode() @@ -47,7 +47,7 @@ final class HorizontalPeerItem: ListViewItem { Queue.mainQueue().async { completion(node, { - return (nil, { + return (nil, { _ in apply(false) }) }) @@ -55,7 +55,7 @@ final class HorizontalPeerItem: ListViewItem { } } - func updateNode(async: @escaping (@escaping () -> Void) -> Void, node: @escaping () -> ListViewItemNode, params: ListViewItemLayoutParams, previousItem: ListViewItem?, nextItem: ListViewItem?, animation: ListViewItemUpdateAnimation, completion: @escaping (ListViewItemNodeLayout, @escaping () -> Void) -> Void) { + func updateNode(async: @escaping (@escaping () -> Void) -> Void, node: @escaping () -> ListViewItemNode, params: ListViewItemLayoutParams, previousItem: ListViewItem?, nextItem: ListViewItem?, animation: ListViewItemUpdateAnimation, completion: @escaping (ListViewItemNodeLayout, @escaping (ListViewItemApply) -> Void) -> Void) { Queue.mainQueue().async { assert(node() is HorizontalPeerItemNode) if let nodeValue = node() as? HorizontalPeerItemNode { @@ -63,7 +63,7 @@ final class HorizontalPeerItem: ListViewItem { async { let (nodeLayout, apply) = layout(self, params) Queue.mainQueue().async { - completion(nodeLayout, { + completion(nodeLayout, { _ in apply(animation.isAnimated) }) } diff --git a/TelegramUI/ICloudResources.swift b/TelegramUI/ICloudResources.swift index f8bccfcd0d..d0f99d093d 100644 --- a/TelegramUI/ICloudResources.swift +++ b/TelegramUI/ICloudResources.swift @@ -42,7 +42,7 @@ public class ICloudFileResource: TelegramMediaResource { return ICloudFileResourceId(urlData: self.urlData) } - public func isEqual(to: TelegramMediaResource) -> Bool { + public func isEqual(to: MediaResource) -> Bool { if let to = to as? ICloudFileResource { if self.urlData != to.urlData { return false diff --git a/TelegramUI/ImageCompression.swift b/TelegramUI/ImageCompression.swift index 377579eec0..2eba51d58c 100644 --- a/TelegramUI/ImageCompression.swift +++ b/TelegramUI/ImageCompression.swift @@ -1,6 +1,11 @@ import Foundation import AVFoundation import UIKit +import Display +import TelegramCore +import Postbox + +import TelegramUIPrivateModule func compressImageToJPEG(_ image: UIImage, quality: Float) -> Data? { let data = NSMutableData() @@ -46,3 +51,182 @@ func compressImage(_ image: UIImage, quality: Float) -> Data? { return data as Data } + +public struct TinyThumbnailData: Equatable { + let tablesDataHash: Int32 + let data: Data +} + +func compressTinyThumbnail(_ image: UIImage) -> TinyThumbnailData? { + let size = image.size.fitted(CGSize(width: 40.0, height: 40.0)) + let context = DrawingContext(size: size, scale: 1.0, clear: false) + context.withFlippedContext({ c in + if let image = image.cgImage { + c.draw(image, in: CGRect(origin: CGPoint(), size: size)) + } + }) + + var cinfo = jpeg_compress_struct() + var jerr = jpeg_error_mgr() + + cinfo.err = jpeg_std_error(&jerr) + jpeg_CreateCompress(&cinfo, JPEG_LIB_VERSION, MemoryLayout.size(ofValue: cinfo)) + + cinfo.input_components = 3 + cinfo.in_color_space = JCS_RGB + + jpeg_set_defaults(&cinfo) + jpeg_set_quality(&cinfo, 20, 1) + + var outTablesBuffer: UnsafeMutablePointer? + var outTablesSize: UInt = 0 + jpeg_mem_dest(&cinfo, &outTablesBuffer, &outTablesSize) + jpeg_write_tables(&cinfo) + + var tablesDataHash: Int32 = 0 + if let outTablesBuffer = outTablesBuffer { + let tablesData = Data(bytes: outTablesBuffer, count: Int(outTablesSize)) + tablesDataHash = murMurHash32Data(tablesData) + //let tables = hexString(tablesData) + //print("tablesData \(tables)") + } + + var outBuffer: UnsafeMutablePointer? + var outSize: UInt = 0 + jpeg_mem_dest(&cinfo, &outBuffer, &outSize) + + cinfo.image_width = UInt32(context.size.width) + cinfo.image_height = UInt32(context.size.height) + + jpeg_suppress_tables(&cinfo, 1) + jpeg_start_compress(&cinfo, 0) + + let rowStride = Int(cinfo.image_width) * 3 + var tempBuffer = malloc(rowStride)!.assumingMemoryBound(to: UInt8.self) + defer { + free(tempBuffer) + } + + while cinfo.next_scanline < cinfo.image_height { + let rowPointer = context.bytes.assumingMemoryBound(to: UInt8.self).advanced(by: Int(cinfo.next_scanline) * context.bytesPerRow) + for x in 0 ..< Int(cinfo.image_width) { + for i in 0 ..< 3 { + tempBuffer[x * 3 + i] = rowPointer[x * 4 + i] + } + } + var row: JSAMPROW? = UnsafeMutablePointer(tempBuffer) + jpeg_write_scanlines(&cinfo, &row, 1) + } + + jpeg_finish_compress(&cinfo) + + var result: Data? + if let outBuffer = outBuffer { + result = Data(bytes: outBuffer, count: Int(outSize)) + //print("result \(result.count)") + } + + jpeg_destroy_compress(&cinfo) + + if let result = result { + return TinyThumbnailData(tablesDataHash: tablesDataHash, data: result) + } else { + return nil + } +} + +private let fixedTablesData = dataWithHexString("ffd8ffdb004300281c1e231e19282321232d2b28303c64413c37373c7b585d4964918099968f808c8aa0b4e6c3a0aadaad8a8cc8ffcbdaeef5ffffff9bc1fffffffaffe6fdfff8ffdb0043012b2d2d3c353c76414176f8a58ca5f8f8f8f8f8f8f8f8f8f8f8f8f8f8f8f8f8f8f8f8f8f8f8f8f8f8f8f8f8f8f8f8f8f8f8f8f8f8f8f8f8f8f8f8f8f8f8f8f8f8ffc4001f0000010501010101010100000000000000000102030405060708090a0bffc400b5100002010303020403050504040000017d01020300041105122131410613516107227114328191a1082342b1c11552d1f02433627282090a161718191a25262728292a3435363738393a434445464748494a535455565758595a636465666768696a737475767778797a838485868788898a92939495969798999aa2a3a4a5a6a7a8a9aab2b3b4b5b6b7b8b9bac2c3c4c5c6c7c8c9cad2d3d4d5d6d7d8d9dae1e2e3e4e5e6e7e8e9eaf1f2f3f4f5f6f7f8f9faffc4001f0100030101010101010101010000000000000102030405060708090a0bffc400b51100020102040403040705040400010277000102031104052131061241510761711322328108144291a1b1c109233352f0156272d10a162434e125f11718191a262728292a35363738393a434445464748494a535455565758595a636465666768696a737475767778797a82838485868788898a92939495969798999aa2a3a4a5a6a7a8a9aab2b3b4b5b6b7b8b9bac2c3c4c5c6c7c8c9cad2d3d4d5d6d7d8d9dae2e3e4e5e6e7e8e9eaf2f3f4f5f6f7f8f9faffd9") + +private let fixedTablesDataHash: Int32 = murMurHash32Data(fixedTablesData) + +private struct my_error_mgr { + var pub = jpeg_error_mgr() +} + +func decompressTinyThumbnail(data: TinyThumbnailData) -> UIImage? { + if data.tablesDataHash != fixedTablesDataHash { + return nil + } + + var cinfo = jpeg_decompress_struct() + var jerr = my_error_mgr() + + cinfo.err = jpeg_std_error(&jerr.pub) + //jerr.pub.error_exit = my_error_exit + + /* Establish the setjmp return context for my_error_exit to use. */ + /*if (setjmp(jerr.setjmp_buffer)) { + /* If we get here, the JPEG code has signaled an error. + * We need to clean up the JPEG object, close the input file, and return. + */ + jpeg_destroy_decompress(&cinfo); + fclose(infile); + return 0; + }*/ + + /* Now we can initialize the JPEG decompression object. */ + jpeg_CreateDecompress(&cinfo, JPEG_LIB_VERSION, MemoryLayout.size(ofValue: cinfo)) + + /* Step 2: specify data source (eg, a file) */ + + let fixedTablesDataLength = UInt(fixedTablesData.count) + fixedTablesData.withUnsafeBytes { (bytes: UnsafePointer) -> Void in + jpeg_mem_src(&cinfo, bytes, fixedTablesDataLength) + jpeg_read_header(&cinfo, 0) + } + + let result = data.data.withUnsafeBytes { (bytes: UnsafePointer) -> UIImage? in + jpeg_mem_src(&cinfo, bytes, fixedTablesDataLength) + jpeg_read_header(&cinfo, 1) + jpeg_start_decompress(&cinfo) + let rowStride = Int(cinfo.output_width) * 3 + var tempBuffer = malloc(rowStride)!.assumingMemoryBound(to: UInt8.self) + defer { + free(tempBuffer) + } + let context = DrawingContext(size: CGSize(width: CGFloat(cinfo.output_width), height: CGFloat(cinfo.output_height)), scale: 1.0, clear: false) + while cinfo.output_scanline < cinfo.output_height { + let rowPointer = context.bytes.assumingMemoryBound(to: UInt8.self).advanced(by: Int(cinfo.output_scanline) * context.bytesPerRow) + var row: JSAMPROW? = UnsafeMutablePointer(tempBuffer) + jpeg_read_scanlines(&cinfo, &row, 1) + for x in 0 ..< Int(cinfo.output_width) { + rowPointer[x * 4 + 3] = 255 + for i in 0 ..< 3 { + rowPointer[x * 4 + i] = tempBuffer[x * 3 + i] + } + } + } + return context.generateImage() + } + + jpeg_finish_decompress(&cinfo) + jpeg_destroy_decompress(&cinfo) + + return result +} + +func serializeTinyThumbnail(_ data: TinyThumbnailData) -> String { + var result = "TTh1 \(data.data.count) bytes\n" + result.append(String(data.tablesDataHash, radix: 16)) + result.append(data.data.base64EncodedString()) + let parsed = parseTinyThumbnail(result) + assert(parsed == data) + return result +} + +func parseTinyThumbnail(_ text: String) -> TinyThumbnailData? { + if text.hasPrefix("TTh1") && text.count > 20 { + guard let startIndex = text.range(of: "\n")?.upperBound else { + return nil + } + let start = startIndex.encodedOffset + guard let hash = Int32(String(text[text.index(text.startIndex, offsetBy: start) ..< text.index(text.startIndex, offsetBy: start + 8)]), radix: 16) else { + return nil + } + guard let data = Data(base64Encoded: String(text[text.index(text.startIndex, offsetBy: start + 8)...])) else { + return nil + } + return TinyThumbnailData(tablesDataHash: hash, data: data) + } + return nil +} diff --git a/TelegramUI/InstantPageControllerNode.swift b/TelegramUI/InstantPageControllerNode.swift index 26fd64548d..8c22953b26 100644 --- a/TelegramUI/InstantPageControllerNode.swift +++ b/TelegramUI/InstantPageControllerNode.swift @@ -874,8 +874,8 @@ final class InstantPageControllerNode: ASDisplayNode, UIScrollViewDelegate { let _ = saveToCameraRoll(applicationContext: strongSelf.account.telegramApplicationContext, postbox: strongSelf.account.postbox, mediaReference: .standalone(media: media)).start() } }), ContextMenuAction(content: .text(self.strings.Conversation_ContextMenuShare), action: { [weak self] in - if let strongSelf = self, let image = media.media as? TelegramMediaImage { - strongSelf.present(ShareController(account: strongSelf.account, subject: .image(image.representations)), nil) + if let strongSelf = self, let webPage = strongSelf.webPage, let image = media.media as? TelegramMediaImage { + strongSelf.present(ShareController(account: strongSelf.account, subject: .image(image.representations.map({ ImageRepresentationWithReference(representation: $0, reference: MediaResourceReference.media(media: .webPage(webPage: WebpageReference(webPage), media: image), resource: $0.resource)) }))), nil) } })], catchTapsOutside: true) self.present(controller, ContextMenuControllerPresentationArguments(sourceNodeAndRect: { [weak self] in diff --git a/TelegramUI/InstantPageMediaPlaylist.swift b/TelegramUI/InstantPageMediaPlaylist.swift index 07cd25228d..695c6ddfea 100644 --- a/TelegramUI/InstantPageMediaPlaylist.swift +++ b/TelegramUI/InstantPageMediaPlaylist.swift @@ -135,6 +135,8 @@ final class InstantPageMediaPlaylist: SharedMediaPlaylist { return InstantPagePlaylistLocation(webpageId: self.webPage.webpageId) } + var currentItemDisappeared: (() -> Void)? + private var currentItem: InstantPageMedia? private var playedToEnd: Bool = false private var order: MusicPlaybackSettingsOrder = .regular diff --git a/TelegramUI/ItemListActionItem.swift b/TelegramUI/ItemListActionItem.swift index 1177fdefbb..68c325e81c 100644 --- a/TelegramUI/ItemListActionItem.swift +++ b/TelegramUI/ItemListActionItem.swift @@ -38,7 +38,7 @@ class ItemListActionItem: ListViewItem, ItemListItem { self.tag = tag } - func nodeConfiguredForParams(async: @escaping (@escaping () -> Void) -> Void, params: ListViewItemLayoutParams, synchronousLoads: Bool, previousItem: ListViewItem?, nextItem: ListViewItem?, completion: @escaping (ListViewItemNode, @escaping () -> (Signal?, () -> Void)) -> Void) { + func nodeConfiguredForParams(async: @escaping (@escaping () -> Void) -> Void, params: ListViewItemLayoutParams, synchronousLoads: Bool, previousItem: ListViewItem?, nextItem: ListViewItem?, completion: @escaping (ListViewItemNode, @escaping () -> (Signal?, (ListViewItemApply) -> Void)) -> Void) { async { let node = ItemListActionItemNode() let (layout, apply) = node.asyncLayout()(self, params, itemListNeighbors(item: self, topItem: previousItem as? ItemListItem, bottomItem: nextItem as? ItemListItem)) @@ -48,13 +48,13 @@ class ItemListActionItem: ListViewItem, ItemListItem { Queue.mainQueue().async { completion(node, { - return (nil, { apply() }) + return (nil, { _ in apply() }) }) } } } - func updateNode(async: @escaping (@escaping () -> Void) -> Void, node: @escaping () -> ListViewItemNode, params: ListViewItemLayoutParams, previousItem: ListViewItem?, nextItem: ListViewItem?, animation: ListViewItemUpdateAnimation, completion: @escaping (ListViewItemNodeLayout, @escaping () -> Void) -> Void) { + func updateNode(async: @escaping (@escaping () -> Void) -> Void, node: @escaping () -> ListViewItemNode, params: ListViewItemLayoutParams, previousItem: ListViewItem?, nextItem: ListViewItem?, animation: ListViewItemUpdateAnimation, completion: @escaping (ListViewItemNodeLayout, @escaping (ListViewItemApply) -> Void) -> Void) { Queue.mainQueue().async { if let nodeValue = node() as? ItemListActionItemNode { let makeLayout = nodeValue.asyncLayout() @@ -62,7 +62,7 @@ class ItemListActionItem: ListViewItem, ItemListItem { async { let (layout, apply) = makeLayout(self, params, itemListNeighbors(item: self, topItem: previousItem as? ItemListItem, bottomItem: nextItem as? ItemListItem)) Queue.mainQueue().async { - completion(layout, { + completion(layout, { _ in apply() }) } diff --git a/TelegramUI/ItemListActivityTextItem.swift b/TelegramUI/ItemListActivityTextItem.swift index 6c04c1ca89..3b58544f7b 100644 --- a/TelegramUI/ItemListActivityTextItem.swift +++ b/TelegramUI/ItemListActivityTextItem.swift @@ -18,7 +18,7 @@ class ItemListActivityTextItem: ListViewItem, ItemListItem { self.sectionId = sectionId } - func nodeConfiguredForParams(async: @escaping (@escaping () -> Void) -> Void, params: ListViewItemLayoutParams, synchronousLoads: Bool, previousItem: ListViewItem?, nextItem: ListViewItem?, completion: @escaping (ListViewItemNode, @escaping () -> (Signal?, () -> Void)) -> Void) { + func nodeConfiguredForParams(async: @escaping (@escaping () -> Void) -> Void, params: ListViewItemLayoutParams, synchronousLoads: Bool, previousItem: ListViewItem?, nextItem: ListViewItem?, completion: @escaping (ListViewItemNode, @escaping () -> (Signal?, (ListViewItemApply) -> Void)) -> Void) { async { let node = ItemListActivityTextItemNode() let (layout, apply) = node.asyncLayout()(self, params, itemListNeighbors(item: self, topItem: previousItem as? ItemListItem, bottomItem: nextItem as? ItemListItem)) @@ -28,13 +28,13 @@ class ItemListActivityTextItem: ListViewItem, ItemListItem { Queue.mainQueue().async { completion(node, { - return (nil, { apply() }) + return (nil, { _ in apply() }) }) } } } - func updateNode(async: @escaping (@escaping () -> Void) -> Void, node: @escaping () -> ListViewItemNode, params: ListViewItemLayoutParams, previousItem: ListViewItem?, nextItem: ListViewItem?, animation: ListViewItemUpdateAnimation, completion: @escaping (ListViewItemNodeLayout, @escaping () -> Void) -> Void) { + func updateNode(async: @escaping (@escaping () -> Void) -> Void, node: @escaping () -> ListViewItemNode, params: ListViewItemLayoutParams, previousItem: ListViewItem?, nextItem: ListViewItem?, animation: ListViewItemUpdateAnimation, completion: @escaping (ListViewItemNodeLayout, @escaping (ListViewItemApply) -> Void) -> Void) { Queue.mainQueue().async { guard let nodeValue = node() as? ItemListActivityTextItemNode else { assertionFailure() @@ -46,7 +46,7 @@ class ItemListActivityTextItem: ListViewItem, ItemListItem { async { let (layout, apply) = makeLayout(self, params, itemListNeighbors(item: self, topItem: previousItem as? ItemListItem, bottomItem: nextItem as? ItemListItem)) Queue.mainQueue().async { - completion(layout, { + completion(layout, { _ in apply() }) } diff --git a/TelegramUI/ItemListAvatarAndNameItem.swift b/TelegramUI/ItemListAvatarAndNameItem.swift index 9d65d33f11..8baee9f1da 100644 --- a/TelegramUI/ItemListAvatarAndNameItem.swift +++ b/TelegramUI/ItemListAvatarAndNameItem.swift @@ -201,7 +201,7 @@ class ItemListAvatarAndNameInfoItem: ListViewItem, ItemListItem { } } - func nodeConfiguredForParams(async: @escaping (@escaping () -> Void) -> Void, params: ListViewItemLayoutParams, synchronousLoads: Bool, previousItem: ListViewItem?, nextItem: ListViewItem?, completion: @escaping (ListViewItemNode, @escaping () -> (Signal?, () -> Void)) -> Void) { + func nodeConfiguredForParams(async: @escaping (@escaping () -> Void) -> Void, params: ListViewItemLayoutParams, synchronousLoads: Bool, previousItem: ListViewItem?, nextItem: ListViewItem?, completion: @escaping (ListViewItemNode, @escaping () -> (Signal?, (ListViewItemApply) -> Void)) -> Void) { async { let node = ItemListAvatarAndNameInfoItemNode() let (layout, apply) = node.asyncLayout()(self, params, itemListNeighbors(item: self, topItem: previousItem as? ItemListItem, bottomItem: nextItem as? ItemListItem)) @@ -210,12 +210,12 @@ class ItemListAvatarAndNameInfoItem: ListViewItem, ItemListItem { node.insets = layout.insets completion(node, { - return (nil, { apply(false) }) + return (nil, { _ in apply(false) }) }) } } - func updateNode(async: @escaping (@escaping () -> Void) -> Void, node: @escaping () -> ListViewItemNode, params: ListViewItemLayoutParams, previousItem: ListViewItem?, nextItem: ListViewItem?, animation: ListViewItemUpdateAnimation, completion: @escaping (ListViewItemNodeLayout, @escaping () -> Void) -> Void) { + func updateNode(async: @escaping (@escaping () -> Void) -> Void, node: @escaping () -> ListViewItemNode, params: ListViewItemLayoutParams, previousItem: ListViewItem?, nextItem: ListViewItem?, animation: ListViewItemUpdateAnimation, completion: @escaping (ListViewItemNodeLayout, @escaping (ListViewItemApply) -> Void) -> Void) { Queue.mainQueue().async { if let nodeValue = node() as? ItemListAvatarAndNameInfoItemNode { var animated = true @@ -227,7 +227,7 @@ class ItemListAvatarAndNameInfoItem: ListViewItem, ItemListItem { async { let (layout, apply) = makeLayout(self, params, itemListNeighbors(item: self, topItem: previousItem as? ItemListItem, bottomItem: nextItem as? ItemListItem)) Queue.mainQueue().async { - completion(layout, { + completion(layout, { _ in apply(animated) }) } diff --git a/TelegramUI/ItemListCallListItem.swift b/TelegramUI/ItemListCallListItem.swift index 4038b39e04..4a30f0bcae 100644 --- a/TelegramUI/ItemListCallListItem.swift +++ b/TelegramUI/ItemListCallListItem.swift @@ -22,7 +22,7 @@ class ItemListCallListItem: ListViewItem, ItemListItem { self.style = style } - func nodeConfiguredForParams(async: @escaping (@escaping () -> Void) -> Void, params: ListViewItemLayoutParams, synchronousLoads: Bool, previousItem: ListViewItem?, nextItem: ListViewItem?, completion: @escaping (ListViewItemNode, @escaping () -> (Signal?, () -> Void)) -> Void) { + func nodeConfiguredForParams(async: @escaping (@escaping () -> Void) -> Void, params: ListViewItemLayoutParams, synchronousLoads: Bool, previousItem: ListViewItem?, nextItem: ListViewItem?, completion: @escaping (ListViewItemNode, @escaping () -> (Signal?, (ListViewItemApply) -> Void)) -> Void) { async { let node = ItemListCallListItemNode() let (layout, apply) = node.asyncLayout()(self, params, itemListNeighbors(item: self, topItem: previousItem as? ItemListItem, bottomItem: nextItem as? ItemListItem)) @@ -32,13 +32,13 @@ class ItemListCallListItem: ListViewItem, ItemListItem { Queue.mainQueue().async { completion(node, { - return (nil, { apply() }) + return (nil, { _ in apply() }) }) } } } - func updateNode(async: @escaping (@escaping () -> Void) -> Void, node: @escaping () -> ListViewItemNode, params: ListViewItemLayoutParams, previousItem: ListViewItem?, nextItem: ListViewItem?, animation: ListViewItemUpdateAnimation, completion: @escaping (ListViewItemNodeLayout, @escaping () -> Void) -> Void) { + func updateNode(async: @escaping (@escaping () -> Void) -> Void, node: @escaping () -> ListViewItemNode, params: ListViewItemLayoutParams, previousItem: ListViewItem?, nextItem: ListViewItem?, animation: ListViewItemUpdateAnimation, completion: @escaping (ListViewItemNodeLayout, @escaping (ListViewItemApply) -> Void) -> Void) { Queue.mainQueue().async { if let nodeValue = node() as? ItemListCallListItemNode { let makeLayout = nodeValue.asyncLayout() @@ -46,7 +46,7 @@ class ItemListCallListItem: ListViewItem, ItemListItem { async { let (layout, apply) = makeLayout(self, params, itemListNeighbors(item: self, topItem: previousItem as? ItemListItem, bottomItem: nextItem as? ItemListItem)) Queue.mainQueue().async { - completion(layout, { + completion(layout, { _ in apply() }) } diff --git a/TelegramUI/ItemListCheckboxItem.swift b/TelegramUI/ItemListCheckboxItem.swift index e1fd12d891..cf955d0046 100644 --- a/TelegramUI/ItemListCheckboxItem.swift +++ b/TelegramUI/ItemListCheckboxItem.swift @@ -34,7 +34,7 @@ class ItemListCheckboxItem: ListViewItem, ItemListItem { self.action = action } - func nodeConfiguredForParams(async: @escaping (@escaping () -> Void) -> Void, params: ListViewItemLayoutParams, synchronousLoads: Bool, previousItem: ListViewItem?, nextItem: ListViewItem?, completion: @escaping (ListViewItemNode, @escaping () -> (Signal?, () -> Void)) -> Void) { + func nodeConfiguredForParams(async: @escaping (@escaping () -> Void) -> Void, params: ListViewItemLayoutParams, synchronousLoads: Bool, previousItem: ListViewItem?, nextItem: ListViewItem?, completion: @escaping (ListViewItemNode, @escaping () -> (Signal?, (ListViewItemApply) -> Void)) -> Void) { async { let node = ItemListCheckboxItemNode() let (layout, apply) = node.asyncLayout()(self, params, itemListNeighbors(item: self, topItem: previousItem as? ItemListItem, bottomItem: nextItem as? ItemListItem)) @@ -44,13 +44,13 @@ class ItemListCheckboxItem: ListViewItem, ItemListItem { Queue.mainQueue().async { completion(node, { - return (nil, { apply() }) + return (nil, { _ in apply() }) }) } } } - func updateNode(async: @escaping (@escaping () -> Void) -> Void, node: @escaping () -> ListViewItemNode, params: ListViewItemLayoutParams, previousItem: ListViewItem?, nextItem: ListViewItem?, animation: ListViewItemUpdateAnimation, completion: @escaping (ListViewItemNodeLayout, @escaping () -> Void) -> Void) { + func updateNode(async: @escaping (@escaping () -> Void) -> Void, node: @escaping () -> ListViewItemNode, params: ListViewItemLayoutParams, previousItem: ListViewItem?, nextItem: ListViewItem?, animation: ListViewItemUpdateAnimation, completion: @escaping (ListViewItemNodeLayout, @escaping (ListViewItemApply) -> Void) -> Void) { Queue.mainQueue().async { if let nodeValue = node() as? ItemListCheckboxItemNode { let makeLayout = nodeValue.asyncLayout() @@ -58,7 +58,7 @@ class ItemListCheckboxItem: ListViewItem, ItemListItem { async { let (layout, apply) = makeLayout(self, params, itemListNeighbors(item: self, topItem: previousItem as? ItemListItem, bottomItem: nextItem as? ItemListItem)) Queue.mainQueue().async { - completion(layout, { + completion(layout, { _ in apply() }) } diff --git a/TelegramUI/ItemListDisclosureItem.swift b/TelegramUI/ItemListDisclosureItem.swift index 29fed9b6c2..999cd3b25e 100644 --- a/TelegramUI/ItemListDisclosureItem.swift +++ b/TelegramUI/ItemListDisclosureItem.swift @@ -51,7 +51,7 @@ class ItemListDisclosureItem: ListViewItem, ItemListItem { self.action = action } - func nodeConfiguredForParams(async: @escaping (@escaping () -> Void) -> Void, params: ListViewItemLayoutParams, synchronousLoads: Bool, previousItem: ListViewItem?, nextItem: ListViewItem?, completion: @escaping (ListViewItemNode, @escaping () -> (Signal?, () -> Void)) -> Void) { + func nodeConfiguredForParams(async: @escaping (@escaping () -> Void) -> Void, params: ListViewItemLayoutParams, synchronousLoads: Bool, previousItem: ListViewItem?, nextItem: ListViewItem?, completion: @escaping (ListViewItemNode, @escaping () -> (Signal?, (ListViewItemApply) -> Void)) -> Void) { async { let node = ItemListDisclosureItemNode() let (layout, apply) = node.asyncLayout()(self, params, itemListNeighbors(item: self, topItem: previousItem as? ItemListItem, bottomItem: nextItem as? ItemListItem)) @@ -61,13 +61,13 @@ class ItemListDisclosureItem: ListViewItem, ItemListItem { Queue.mainQueue().async { completion(node, { - return (nil, { apply() }) + return (nil, { _ in apply() }) }) } } } - func updateNode(async: @escaping (@escaping () -> Void) -> Void, node: @escaping () -> ListViewItemNode, params: ListViewItemLayoutParams, previousItem: ListViewItem?, nextItem: ListViewItem?, animation: ListViewItemUpdateAnimation, completion: @escaping (ListViewItemNodeLayout, @escaping () -> Void) -> Void) { + func updateNode(async: @escaping (@escaping () -> Void) -> Void, node: @escaping () -> ListViewItemNode, params: ListViewItemLayoutParams, previousItem: ListViewItem?, nextItem: ListViewItem?, animation: ListViewItemUpdateAnimation, completion: @escaping (ListViewItemNodeLayout, @escaping (ListViewItemApply) -> Void) -> Void) { Queue.mainQueue().async { if let nodeValue = node() as? ItemListDisclosureItemNode { let makeLayout = nodeValue.asyncLayout() @@ -75,7 +75,7 @@ class ItemListDisclosureItem: ListViewItem, ItemListItem { async { let (layout, apply) = makeLayout(self, params, itemListNeighbors(item: self, topItem: previousItem as? ItemListItem, bottomItem: nextItem as? ItemListItem)) Queue.mainQueue().async { - completion(layout, { + completion(layout, { _ in apply() }) } diff --git a/TelegramUI/ItemListMultilineInputItem.swift b/TelegramUI/ItemListMultilineInputItem.swift index 291662c5bf..c3eabb2292 100644 --- a/TelegramUI/ItemListMultilineInputItem.swift +++ b/TelegramUI/ItemListMultilineInputItem.swift @@ -26,7 +26,7 @@ class ItemListMultilineInputItem: ListViewItem, ItemListItem { self.action = action } - func nodeConfiguredForParams(async: @escaping (@escaping () -> Void) -> Void, params: ListViewItemLayoutParams, synchronousLoads: Bool, previousItem: ListViewItem?, nextItem: ListViewItem?, completion: @escaping (ListViewItemNode, @escaping () -> (Signal?, () -> Void)) -> Void) { + func nodeConfiguredForParams(async: @escaping (@escaping () -> Void) -> Void, params: ListViewItemLayoutParams, synchronousLoads: Bool, previousItem: ListViewItem?, nextItem: ListViewItem?, completion: @escaping (ListViewItemNode, @escaping () -> (Signal?, (ListViewItemApply) -> Void)) -> Void) { async { let node = ItemListMultilineInputItemNode() let (layout, apply) = node.asyncLayout()(self, params, itemListNeighbors(item: self, topItem: previousItem as? ItemListItem, bottomItem: nextItem as? ItemListItem)) @@ -36,13 +36,13 @@ class ItemListMultilineInputItem: ListViewItem, ItemListItem { Queue.mainQueue().async { completion(node, { - return (nil, { apply() }) + return (nil, { _ in apply() }) }) } } } - func updateNode(async: @escaping (@escaping () -> Void) -> Void, node: @escaping () -> ListViewItemNode, params: ListViewItemLayoutParams, previousItem: ListViewItem?, nextItem: ListViewItem?, animation: ListViewItemUpdateAnimation, completion: @escaping (ListViewItemNodeLayout, @escaping () -> Void) -> Void) { + func updateNode(async: @escaping (@escaping () -> Void) -> Void, node: @escaping () -> ListViewItemNode, params: ListViewItemLayoutParams, previousItem: ListViewItem?, nextItem: ListViewItem?, animation: ListViewItemUpdateAnimation, completion: @escaping (ListViewItemNodeLayout, @escaping (ListViewItemApply) -> Void) -> Void) { Queue.mainQueue().async { if let nodeValue = node() as? ItemListMultilineInputItemNode { let makeLayout = nodeValue.asyncLayout() @@ -50,7 +50,7 @@ class ItemListMultilineInputItem: ListViewItem, ItemListItem { async { let (layout, apply) = makeLayout(self, params, itemListNeighbors(item: self, topItem: previousItem as? ItemListItem, bottomItem: nextItem as? ItemListItem)) Queue.mainQueue().async { - completion(layout, { + completion(layout, { _ in apply() }) } diff --git a/TelegramUI/ItemListMultilineTextItem.swift b/TelegramUI/ItemListMultilineTextItem.swift index 6f1b9ec295..409af195b0 100644 --- a/TelegramUI/ItemListMultilineTextItem.swift +++ b/TelegramUI/ItemListMultilineTextItem.swift @@ -42,7 +42,7 @@ class ItemListMultilineTextItem: ListViewItem, ItemListItem { self.selectable = action != nil } - func nodeConfiguredForParams(async: @escaping (@escaping () -> Void) -> Void, params: ListViewItemLayoutParams, synchronousLoads: Bool, previousItem: ListViewItem?, nextItem: ListViewItem?, completion: @escaping (ListViewItemNode, @escaping () -> (Signal?, () -> Void)) -> Void) { + func nodeConfiguredForParams(async: @escaping (@escaping () -> Void) -> Void, params: ListViewItemLayoutParams, synchronousLoads: Bool, previousItem: ListViewItem?, nextItem: ListViewItem?, completion: @escaping (ListViewItemNode, @escaping () -> (Signal?, (ListViewItemApply) -> Void)) -> Void) { async { let node = ItemListMultilineTextItemNode() let (layout, apply) = node.asyncLayout()(self, params, itemListNeighbors(item: self, topItem: previousItem as? ItemListItem, bottomItem: nextItem as? ItemListItem)) @@ -52,13 +52,13 @@ class ItemListMultilineTextItem: ListViewItem, ItemListItem { Queue.mainQueue().async { completion(node, { - return (nil, { apply() }) + return (nil, { _ in apply() }) }) } } } - func updateNode(async: @escaping (@escaping () -> Void) -> Void, node: @escaping () -> ListViewItemNode, params: ListViewItemLayoutParams, previousItem: ListViewItem?, nextItem: ListViewItem?, animation: ListViewItemUpdateAnimation, completion: @escaping (ListViewItemNodeLayout, @escaping () -> Void) -> Void) { + func updateNode(async: @escaping (@escaping () -> Void) -> Void, node: @escaping () -> ListViewItemNode, params: ListViewItemLayoutParams, previousItem: ListViewItem?, nextItem: ListViewItem?, animation: ListViewItemUpdateAnimation, completion: @escaping (ListViewItemNodeLayout, @escaping (ListViewItemApply) -> Void) -> Void) { Queue.mainQueue().async { if let nodeValue = node() as? ItemListMultilineTextItemNode { let makeLayout = nodeValue.asyncLayout() @@ -66,7 +66,7 @@ class ItemListMultilineTextItem: ListViewItem, ItemListItem { async { let (layout, apply) = makeLayout(self, params, itemListNeighbors(item: self, topItem: previousItem as? ItemListItem, bottomItem: nextItem as? ItemListItem)) Queue.mainQueue().async { - completion(layout, { + completion(layout, { _ in apply() }) } diff --git a/TelegramUI/ItemListPeerActionItem.swift b/TelegramUI/ItemListPeerActionItem.swift index 4e2da9b0ae..9d4c32f9e4 100644 --- a/TelegramUI/ItemListPeerActionItem.swift +++ b/TelegramUI/ItemListPeerActionItem.swift @@ -20,7 +20,7 @@ class ItemListPeerActionItem: ListViewItem, ItemListItem { self.action = action } - func nodeConfiguredForParams(async: @escaping (@escaping () -> Void) -> Void, params: ListViewItemLayoutParams, synchronousLoads: Bool, previousItem: ListViewItem?, nextItem: ListViewItem?, completion: @escaping (ListViewItemNode, @escaping () -> (Signal?, () -> Void)) -> Void) { + func nodeConfiguredForParams(async: @escaping (@escaping () -> Void) -> Void, params: ListViewItemLayoutParams, synchronousLoads: Bool, previousItem: ListViewItem?, nextItem: ListViewItem?, completion: @escaping (ListViewItemNode, @escaping () -> (Signal?, (ListViewItemApply) -> Void)) -> Void) { async { let node = ItemListPeerActionItemNode() let (layout, apply) = node.asyncLayout()(self, params, itemListNeighbors(item: self, topItem: previousItem as? ItemListItem, bottomItem: nextItem as? ItemListItem)) @@ -30,13 +30,13 @@ class ItemListPeerActionItem: ListViewItem, ItemListItem { Queue.mainQueue().async { completion(node, { - return (nil, { apply(false) }) + return (nil, { _ in apply(false) }) }) } } } - func updateNode(async: @escaping (@escaping () -> Void) -> Void, node: @escaping () -> ListViewItemNode, params: ListViewItemLayoutParams, previousItem: ListViewItem?, nextItem: ListViewItem?, animation: ListViewItemUpdateAnimation, completion: @escaping (ListViewItemNodeLayout, @escaping () -> Void) -> Void) { + func updateNode(async: @escaping (@escaping () -> Void) -> Void, node: @escaping () -> ListViewItemNode, params: ListViewItemLayoutParams, previousItem: ListViewItem?, nextItem: ListViewItem?, animation: ListViewItemUpdateAnimation, completion: @escaping (ListViewItemNodeLayout, @escaping (ListViewItemApply) -> Void) -> Void) { Queue.mainQueue().async { if let nodeValue = node() as? ItemListPeerActionItemNode { let makeLayout = nodeValue.asyncLayout() @@ -49,7 +49,7 @@ class ItemListPeerActionItem: ListViewItem, ItemListItem { async { let (layout, apply) = makeLayout(self, params, itemListNeighbors(item: self, topItem: previousItem as? ItemListItem, bottomItem: nextItem as? ItemListItem)) Queue.mainQueue().async { - completion(layout, { + completion(layout, { _ in apply(animated) }) } diff --git a/TelegramUI/ItemListPeerItem.swift b/TelegramUI/ItemListPeerItem.swift index 1b65e2e302..764edb88a0 100644 --- a/TelegramUI/ItemListPeerItem.swift +++ b/TelegramUI/ItemListPeerItem.swift @@ -105,7 +105,7 @@ final class ItemListPeerItem: ListViewItem, ItemListItem { self.hasTopGroupInset = hasTopGroupInset } - func nodeConfiguredForParams(async: @escaping (@escaping () -> Void) -> Void, params: ListViewItemLayoutParams, synchronousLoads: Bool, previousItem: ListViewItem?, nextItem: ListViewItem?, completion: @escaping (ListViewItemNode, @escaping () -> (Signal?, () -> Void)) -> Void) { + func nodeConfiguredForParams(async: @escaping (@escaping () -> Void) -> Void, params: ListViewItemLayoutParams, synchronousLoads: Bool, previousItem: ListViewItem?, nextItem: ListViewItem?, completion: @escaping (ListViewItemNode, @escaping () -> (Signal?, (ListViewItemApply) -> Void)) -> Void) { async { let node = ItemListPeerItemNode() let (layout, apply) = node.asyncLayout()(self, params, itemListNeighbors(item: self, topItem: previousItem as? ItemListItem, bottomItem: nextItem as? ItemListItem)) @@ -115,13 +115,13 @@ final class ItemListPeerItem: ListViewItem, ItemListItem { Queue.mainQueue().async { completion(node, { - return (node.avatarNode.ready, { apply(false) }) + return (node.avatarNode.ready, { _ in apply(false) }) }) } } } - func updateNode(async: @escaping (@escaping () -> Void) -> Void, node: @escaping () -> ListViewItemNode, params: ListViewItemLayoutParams, previousItem: ListViewItem?, nextItem: ListViewItem?, animation: ListViewItemUpdateAnimation, completion: @escaping (ListViewItemNodeLayout, @escaping () -> Void) -> Void) { + func updateNode(async: @escaping (@escaping () -> Void) -> Void, node: @escaping () -> ListViewItemNode, params: ListViewItemLayoutParams, previousItem: ListViewItem?, nextItem: ListViewItem?, animation: ListViewItemUpdateAnimation, completion: @escaping (ListViewItemNodeLayout, @escaping (ListViewItemApply) -> Void) -> Void) { Queue.mainQueue().async { if let nodeValue = node() as? ItemListPeerItemNode { let makeLayout = nodeValue.asyncLayout() @@ -134,7 +134,7 @@ final class ItemListPeerItem: ListViewItem, ItemListItem { async { let (layout, apply) = makeLayout(self, params, itemListNeighbors(item: self, topItem: previousItem as? ItemListItem, bottomItem: nextItem as? ItemListItem)) Queue.mainQueue().async { - completion(layout, { + completion(layout, { _ in apply(animated) }) } diff --git a/TelegramUI/ItemListRecentSessionItem.swift b/TelegramUI/ItemListRecentSessionItem.swift index a043339915..b0268beb60 100644 --- a/TelegramUI/ItemListRecentSessionItem.swift +++ b/TelegramUI/ItemListRecentSessionItem.swift @@ -57,7 +57,7 @@ final class ItemListRecentSessionItem: ListViewItem, ItemListItem { self.removeSession = removeSession } - func nodeConfiguredForParams(async: @escaping (@escaping () -> Void) -> Void, params: ListViewItemLayoutParams, synchronousLoads: Bool, previousItem: ListViewItem?, nextItem: ListViewItem?, completion: @escaping (ListViewItemNode, @escaping () -> (Signal?, () -> Void)) -> Void) { + func nodeConfiguredForParams(async: @escaping (@escaping () -> Void) -> Void, params: ListViewItemLayoutParams, synchronousLoads: Bool, previousItem: ListViewItem?, nextItem: ListViewItem?, completion: @escaping (ListViewItemNode, @escaping () -> (Signal?, (ListViewItemApply) -> Void)) -> Void) { async { let node = ItemListRecentSessionItemNode() let (layout, apply) = node.asyncLayout()(self, params, itemListNeighbors(item: self, topItem: previousItem as? ItemListItem, bottomItem: nextItem as? ItemListItem)) @@ -67,13 +67,13 @@ final class ItemListRecentSessionItem: ListViewItem, ItemListItem { Queue.mainQueue().async { completion(node, { - return (nil, { apply(false) }) + return (nil, { _ in apply(false) }) }) } } } - func updateNode(async: @escaping (@escaping () -> Void) -> Void, node: @escaping () -> ListViewItemNode, params: ListViewItemLayoutParams, previousItem: ListViewItem?, nextItem: ListViewItem?, animation: ListViewItemUpdateAnimation, completion: @escaping (ListViewItemNodeLayout, @escaping () -> Void) -> Void) { + func updateNode(async: @escaping (@escaping () -> Void) -> Void, node: @escaping () -> ListViewItemNode, params: ListViewItemLayoutParams, previousItem: ListViewItem?, nextItem: ListViewItem?, animation: ListViewItemUpdateAnimation, completion: @escaping (ListViewItemNodeLayout, @escaping (ListViewItemApply) -> Void) -> Void) { Queue.mainQueue().async { if let nodeValue = node() as? ItemListRecentSessionItemNode { let makeLayout = nodeValue.asyncLayout() @@ -86,7 +86,7 @@ final class ItemListRecentSessionItem: ListViewItem, ItemListItem { async { let (layout, apply) = makeLayout(self, params, itemListNeighbors(item: self, topItem: previousItem as? ItemListItem, bottomItem: nextItem as? ItemListItem)) Queue.mainQueue().async { - completion(layout, { + completion(layout, { _ in apply(animated) }) } diff --git a/TelegramUI/ItemListSecretChatKeyItem.swift b/TelegramUI/ItemListSecretChatKeyItem.swift index 1543dc33ce..c0ca0e36f5 100644 --- a/TelegramUI/ItemListSecretChatKeyItem.swift +++ b/TelegramUI/ItemListSecretChatKeyItem.swift @@ -25,7 +25,7 @@ class ItemListSecretChatKeyItem: ListViewItem, ItemListItem { self.action = action } - func nodeConfiguredForParams(async: @escaping (@escaping () -> Void) -> Void, params: ListViewItemLayoutParams, synchronousLoads: Bool, previousItem: ListViewItem?, nextItem: ListViewItem?, completion: @escaping (ListViewItemNode, @escaping () -> (Signal?, () -> Void)) -> Void) { + func nodeConfiguredForParams(async: @escaping (@escaping () -> Void) -> Void, params: ListViewItemLayoutParams, synchronousLoads: Bool, previousItem: ListViewItem?, nextItem: ListViewItem?, completion: @escaping (ListViewItemNode, @escaping () -> (Signal?, (ListViewItemApply) -> Void)) -> Void) { async { let node = ItemListSecretChatKeyItemNode() let (layout, apply) = node.asyncLayout()(self, params, itemListNeighbors(item: self, topItem: previousItem as? ItemListItem, bottomItem: nextItem as? ItemListItem)) @@ -35,13 +35,13 @@ class ItemListSecretChatKeyItem: ListViewItem, ItemListItem { Queue.mainQueue().async { completion(node, { - return (nil, { apply() }) + return (nil, { _ in apply() }) }) } } } - func updateNode(async: @escaping (@escaping () -> Void) -> Void, node: @escaping () -> ListViewItemNode, params: ListViewItemLayoutParams, previousItem: ListViewItem?, nextItem: ListViewItem?, animation: ListViewItemUpdateAnimation, completion: @escaping (ListViewItemNodeLayout, @escaping () -> Void) -> Void) { + func updateNode(async: @escaping (@escaping () -> Void) -> Void, node: @escaping () -> ListViewItemNode, params: ListViewItemLayoutParams, previousItem: ListViewItem?, nextItem: ListViewItem?, animation: ListViewItemUpdateAnimation, completion: @escaping (ListViewItemNodeLayout, @escaping (ListViewItemApply) -> Void) -> Void) { Queue.mainQueue().async { if let nodeValue = node() as? ItemListSecretChatKeyItemNode { let makeLayout = nodeValue.asyncLayout() @@ -49,7 +49,7 @@ class ItemListSecretChatKeyItem: ListViewItem, ItemListItem { async { let (layout, apply) = makeLayout(self, params, itemListNeighbors(item: self, topItem: previousItem as? ItemListItem, bottomItem: nextItem as? ItemListItem)) Queue.mainQueue().async { - completion(layout, { + completion(layout, { _ in apply() }) } diff --git a/TelegramUI/ItemListSectionHeaderItem.swift b/TelegramUI/ItemListSectionHeaderItem.swift index fef5dce77f..451f747466 100644 --- a/TelegramUI/ItemListSectionHeaderItem.swift +++ b/TelegramUI/ItemListSectionHeaderItem.swift @@ -16,7 +16,7 @@ class ItemListSectionHeaderItem: ListViewItem, ItemListItem { self.sectionId = sectionId } - func nodeConfiguredForParams(async: @escaping (@escaping () -> Void) -> Void, params: ListViewItemLayoutParams, synchronousLoads: Bool, previousItem: ListViewItem?, nextItem: ListViewItem?, completion: @escaping (ListViewItemNode, @escaping () -> (Signal?, () -> Void)) -> Void) { + func nodeConfiguredForParams(async: @escaping (@escaping () -> Void) -> Void, params: ListViewItemLayoutParams, synchronousLoads: Bool, previousItem: ListViewItem?, nextItem: ListViewItem?, completion: @escaping (ListViewItemNode, @escaping () -> (Signal?, (ListViewItemApply) -> Void)) -> Void) { async { let node = ItemListSectionHeaderItemNode() let (layout, apply) = node.asyncLayout()(self, params, itemListNeighbors(item: self, topItem: previousItem as? ItemListItem, bottomItem: nextItem as? ItemListItem)) @@ -26,13 +26,13 @@ class ItemListSectionHeaderItem: ListViewItem, ItemListItem { Queue.mainQueue().async { completion(node, { - return (nil, { apply() }) + return (nil, { _ in apply() }) }) } } } - func updateNode(async: @escaping (@escaping () -> Void) -> Void, node: @escaping () -> ListViewItemNode, params: ListViewItemLayoutParams, previousItem: ListViewItem?, nextItem: ListViewItem?, animation: ListViewItemUpdateAnimation, completion: @escaping (ListViewItemNodeLayout, @escaping () -> Void) -> Void) { + func updateNode(async: @escaping (@escaping () -> Void) -> Void, node: @escaping () -> ListViewItemNode, params: ListViewItemLayoutParams, previousItem: ListViewItem?, nextItem: ListViewItem?, animation: ListViewItemUpdateAnimation, completion: @escaping (ListViewItemNodeLayout, @escaping (ListViewItemApply) -> Void) -> Void) { Queue.mainQueue().async { guard let nodeValue = node() as? ItemListSectionHeaderItemNode else { assertionFailure() @@ -44,7 +44,7 @@ class ItemListSectionHeaderItem: ListViewItem, ItemListItem { async { let (layout, apply) = makeLayout(self, params, itemListNeighbors(item: self, topItem: previousItem as? ItemListItem, bottomItem: nextItem as? ItemListItem)) Queue.mainQueue().async { - completion(layout, { + completion(layout, { _ in apply() }) } diff --git a/TelegramUI/ItemListSingleLineInputItem.swift b/TelegramUI/ItemListSingleLineInputItem.swift index 9aca4b1381..a9bc815045 100644 --- a/TelegramUI/ItemListSingleLineInputItem.swift +++ b/TelegramUI/ItemListSingleLineInputItem.swift @@ -42,7 +42,7 @@ class ItemListSingleLineInputItem: ListViewItem, ItemListItem { self.action = action } - func nodeConfiguredForParams(async: @escaping (@escaping () -> Void) -> Void, params: ListViewItemLayoutParams, synchronousLoads: Bool, previousItem: ListViewItem?, nextItem: ListViewItem?, completion: @escaping (ListViewItemNode, @escaping () -> (Signal?, () -> Void)) -> Void) { + func nodeConfiguredForParams(async: @escaping (@escaping () -> Void) -> Void, params: ListViewItemLayoutParams, synchronousLoads: Bool, previousItem: ListViewItem?, nextItem: ListViewItem?, completion: @escaping (ListViewItemNode, @escaping () -> (Signal?, (ListViewItemApply) -> Void)) -> Void) { async { let node = ItemListSingleLineInputItemNode() let (layout, apply) = node.asyncLayout()(self, params, itemListNeighbors(item: self, topItem: previousItem as? ItemListItem, bottomItem: nextItem as? ItemListItem)) @@ -52,13 +52,13 @@ class ItemListSingleLineInputItem: ListViewItem, ItemListItem { Queue.mainQueue().async { completion(node, { - return (nil, { apply() }) + return (nil, { _ in apply() }) }) } } } - func updateNode(async: @escaping (@escaping () -> Void) -> Void, node: @escaping () -> ListViewItemNode, params: ListViewItemLayoutParams, previousItem: ListViewItem?, nextItem: ListViewItem?, animation: ListViewItemUpdateAnimation, completion: @escaping (ListViewItemNodeLayout, @escaping () -> Void) -> Void) { + func updateNode(async: @escaping (@escaping () -> Void) -> Void, node: @escaping () -> ListViewItemNode, params: ListViewItemLayoutParams, previousItem: ListViewItem?, nextItem: ListViewItem?, animation: ListViewItemUpdateAnimation, completion: @escaping (ListViewItemNodeLayout, @escaping (ListViewItemApply) -> Void) -> Void) { Queue.mainQueue().async { if let nodeValue = node() as? ItemListSingleLineInputItemNode { @@ -67,7 +67,7 @@ class ItemListSingleLineInputItem: ListViewItem, ItemListItem { async { let (layout, apply) = makeLayout(self, params, itemListNeighbors(item: self, topItem: previousItem as? ItemListItem, bottomItem: nextItem as? ItemListItem)) Queue.mainQueue().async { - completion(layout, { + completion(layout, { _ in apply() }) } diff --git a/TelegramUI/ItemListStickerPackItem.swift b/TelegramUI/ItemListStickerPackItem.swift index 5d641fcf32..fa42039250 100644 --- a/TelegramUI/ItemListStickerPackItem.swift +++ b/TelegramUI/ItemListStickerPackItem.swift @@ -69,7 +69,7 @@ final class ItemListStickerPackItem: ListViewItem, ItemListItem { self.removePack = removePack } - func nodeConfiguredForParams(async: @escaping (@escaping () -> Void) -> Void, params: ListViewItemLayoutParams, synchronousLoads: Bool, previousItem: ListViewItem?, nextItem: ListViewItem?, completion: @escaping (ListViewItemNode, @escaping () -> (Signal?, () -> Void)) -> Void) { + func nodeConfiguredForParams(async: @escaping (@escaping () -> Void) -> Void, params: ListViewItemLayoutParams, synchronousLoads: Bool, previousItem: ListViewItem?, nextItem: ListViewItem?, completion: @escaping (ListViewItemNode, @escaping () -> (Signal?, (ListViewItemApply) -> Void)) -> Void) { async { let node = ItemListStickerPackItemNode() let (layout, apply) = node.asyncLayout()(self, params, itemListNeighbors(item: self, topItem: previousItem as? ItemListItem, bottomItem: nextItem as? ItemListItem)) @@ -79,13 +79,13 @@ final class ItemListStickerPackItem: ListViewItem, ItemListItem { Queue.mainQueue().async { completion(node, { - return (nil, { apply(false) }) + return (nil, { _ in apply(false) }) }) } } } - func updateNode(async: @escaping (@escaping () -> Void) -> Void, node: @escaping () -> ListViewItemNode, params: ListViewItemLayoutParams, previousItem: ListViewItem?, nextItem: ListViewItem?, animation: ListViewItemUpdateAnimation, completion: @escaping (ListViewItemNodeLayout, @escaping () -> Void) -> Void) { + func updateNode(async: @escaping (@escaping () -> Void) -> Void, node: @escaping () -> ListViewItemNode, params: ListViewItemLayoutParams, previousItem: ListViewItem?, nextItem: ListViewItem?, animation: ListViewItemUpdateAnimation, completion: @escaping (ListViewItemNodeLayout, @escaping (ListViewItemApply) -> Void) -> Void) { Queue.mainQueue().async { if let nodeValue = node() as? ItemListStickerPackItemNode { let makeLayout = nodeValue.asyncLayout() @@ -98,7 +98,7 @@ final class ItemListStickerPackItem: ListViewItem, ItemListItem { async { let (layout, apply) = makeLayout(self, params, itemListNeighbors(item: self, topItem: previousItem as? ItemListItem, bottomItem: nextItem as? ItemListItem)) Queue.mainQueue().async { - completion(layout, { + completion(layout, { _ in apply(animated) }) } diff --git a/TelegramUI/ItemListSwitchItem.swift b/TelegramUI/ItemListSwitchItem.swift index 4351a3290f..8ff7d9a13c 100644 --- a/TelegramUI/ItemListSwitchItem.swift +++ b/TelegramUI/ItemListSwitchItem.swift @@ -31,7 +31,7 @@ class ItemListSwitchItem: ListViewItem, ItemListItem { self.updated = updated } - func nodeConfiguredForParams(async: @escaping (@escaping () -> Void) -> Void, params: ListViewItemLayoutParams, synchronousLoads: Bool, previousItem: ListViewItem?, nextItem: ListViewItem?, completion: @escaping (ListViewItemNode, @escaping () -> (Signal?, () -> Void)) -> Void) { + func nodeConfiguredForParams(async: @escaping (@escaping () -> Void) -> Void, params: ListViewItemLayoutParams, synchronousLoads: Bool, previousItem: ListViewItem?, nextItem: ListViewItem?, completion: @escaping (ListViewItemNode, @escaping () -> (Signal?, (ListViewItemApply) -> Void)) -> Void) { async { let node = ItemListSwitchItemNode(type: self.type) let (layout, apply) = node.asyncLayout()(self, params, itemListNeighbors(item: self, topItem: previousItem as? ItemListItem, bottomItem: nextItem as? ItemListItem)) @@ -41,13 +41,13 @@ class ItemListSwitchItem: ListViewItem, ItemListItem { Queue.mainQueue().async { completion(node, { - return (nil, { apply(false) }) + return (nil, { _ in apply(false) }) }) } } } - func updateNode(async: @escaping (@escaping () -> Void) -> Void, node: @escaping () -> ListViewItemNode, params: ListViewItemLayoutParams, previousItem: ListViewItem?, nextItem: ListViewItem?, animation: ListViewItemUpdateAnimation, completion: @escaping (ListViewItemNodeLayout, @escaping () -> Void) -> Void) { + func updateNode(async: @escaping (@escaping () -> Void) -> Void, node: @escaping () -> ListViewItemNode, params: ListViewItemLayoutParams, previousItem: ListViewItem?, nextItem: ListViewItem?, animation: ListViewItemUpdateAnimation, completion: @escaping (ListViewItemNodeLayout, @escaping (ListViewItemApply) -> Void) -> Void) { Queue.mainQueue().async { if let nodeValue = node() as? ItemListSwitchItemNode { let makeLayout = nodeValue.asyncLayout() @@ -55,7 +55,7 @@ class ItemListSwitchItem: ListViewItem, ItemListItem { async { let (layout, apply) = makeLayout(self, params, itemListNeighbors(item: self, topItem: previousItem as? ItemListItem, bottomItem: nextItem as? ItemListItem)) Queue.mainQueue().async { - completion(layout, { + completion(layout, { _ in var animated = true if case .None = animation { animated = false diff --git a/TelegramUI/ItemListTextItem.swift b/TelegramUI/ItemListTextItem.swift index 385e623766..4e5c6fe2f3 100644 --- a/TelegramUI/ItemListTextItem.swift +++ b/TelegramUI/ItemListTextItem.swift @@ -28,7 +28,7 @@ class ItemListTextItem: ListViewItem, ItemListItem { self.style = style } - func nodeConfiguredForParams(async: @escaping (@escaping () -> Void) -> Void, params: ListViewItemLayoutParams, synchronousLoads: Bool, previousItem: ListViewItem?, nextItem: ListViewItem?, completion: @escaping (ListViewItemNode, @escaping () -> (Signal?, () -> Void)) -> Void) { + func nodeConfiguredForParams(async: @escaping (@escaping () -> Void) -> Void, params: ListViewItemLayoutParams, synchronousLoads: Bool, previousItem: ListViewItem?, nextItem: ListViewItem?, completion: @escaping (ListViewItemNode, @escaping () -> (Signal?, (ListViewItemApply) -> Void)) -> Void) { async { let node = ItemListTextItemNode() let (layout, apply) = node.asyncLayout()(self, params, itemListNeighbors(item: self, topItem: previousItem as? ItemListItem, bottomItem: nextItem as? ItemListItem)) @@ -38,13 +38,13 @@ class ItemListTextItem: ListViewItem, ItemListItem { Queue.mainQueue().async { completion(node, { - return (nil, { apply() }) + return (nil, { _ in apply() }) }) } } } - func updateNode(async: @escaping (@escaping () -> Void) -> Void, node: @escaping () -> ListViewItemNode, params: ListViewItemLayoutParams, previousItem: ListViewItem?, nextItem: ListViewItem?, animation: ListViewItemUpdateAnimation, completion: @escaping (ListViewItemNodeLayout, @escaping () -> Void) -> Void) { + func updateNode(async: @escaping (@escaping () -> Void) -> Void, node: @escaping () -> ListViewItemNode, params: ListViewItemLayoutParams, previousItem: ListViewItem?, nextItem: ListViewItem?, animation: ListViewItemUpdateAnimation, completion: @escaping (ListViewItemNodeLayout, @escaping (ListViewItemApply) -> Void) -> Void) { Queue.mainQueue().async { guard let nodeValue = node() as? ItemListTextItemNode else { assertionFailure() @@ -56,7 +56,7 @@ class ItemListTextItem: ListViewItem, ItemListItem { async { let (layout, apply) = makeLayout(self, params, itemListNeighbors(item: self, topItem: previousItem as? ItemListItem, bottomItem: nextItem as? ItemListItem)) Queue.mainQueue().async { - completion(layout, { + completion(layout, { _ in apply() }) } diff --git a/TelegramUI/ItemListTextWithLabelItem.swift b/TelegramUI/ItemListTextWithLabelItem.swift index faebcaa0ea..00c150c667 100644 --- a/TelegramUI/ItemListTextWithLabelItem.swift +++ b/TelegramUI/ItemListTextWithLabelItem.swift @@ -41,7 +41,7 @@ final class ItemListTextWithLabelItem: ListViewItem, ItemListItem { self.tag = tag } - func nodeConfiguredForParams(async: @escaping (@escaping () -> Void) -> Void, params: ListViewItemLayoutParams, synchronousLoads: Bool, previousItem: ListViewItem?, nextItem: ListViewItem?, completion: @escaping (ListViewItemNode, @escaping () -> (Signal?, () -> Void)) -> Void) { + func nodeConfiguredForParams(async: @escaping (@escaping () -> Void) -> Void, params: ListViewItemLayoutParams, synchronousLoads: Bool, previousItem: ListViewItem?, nextItem: ListViewItem?, completion: @escaping (ListViewItemNode, @escaping () -> (Signal?, (ListViewItemApply) -> Void)) -> Void) { async { let node = ItemListTextWithLabelItemNode() let (layout, apply) = node.asyncLayout()(self, params, itemListNeighbors(item: self, topItem: previousItem as? ItemListItem, bottomItem: nextItem as? ItemListItem)) @@ -51,13 +51,13 @@ final class ItemListTextWithLabelItem: ListViewItem, ItemListItem { Queue.mainQueue().async { completion(node, { - return (nil, { apply(.None) }) + return (nil, { _ in apply(.None) }) }) } } } - func updateNode(async: @escaping (@escaping () -> Void) -> Void, node: @escaping () -> ListViewItemNode, params: ListViewItemLayoutParams, previousItem: ListViewItem?, nextItem: ListViewItem?, animation: ListViewItemUpdateAnimation, completion: @escaping (ListViewItemNodeLayout, @escaping () -> Void) -> Void) { + func updateNode(async: @escaping (@escaping () -> Void) -> Void, node: @escaping () -> ListViewItemNode, params: ListViewItemLayoutParams, previousItem: ListViewItem?, nextItem: ListViewItem?, animation: ListViewItemUpdateAnimation, completion: @escaping (ListViewItemNodeLayout, @escaping (ListViewItemApply) -> Void) -> Void) { Queue.mainQueue().async { if let nodeValue = node() as? ItemListTextWithLabelItemNode { let makeLayout = nodeValue.asyncLayout() @@ -65,7 +65,7 @@ final class ItemListTextWithLabelItem: ListViewItem, ItemListItem { async { let (layout, apply) = makeLayout(self, params, itemListNeighbors(item: self, topItem: previousItem as? ItemListItem, bottomItem: nextItem as? ItemListItem)) Queue.mainQueue().async { - completion(layout, { + completion(layout, { _ in apply(animation) }) } diff --git a/TelegramUI/ItemListWebsiteItem.swift b/TelegramUI/ItemListWebsiteItem.swift index 475bf6e310..d59c38a476 100644 --- a/TelegramUI/ItemListWebsiteItem.swift +++ b/TelegramUI/ItemListWebsiteItem.swift @@ -47,7 +47,7 @@ final class ItemListWebsiteItem: ListViewItem, ItemListItem { self.removeSession = removeSession } - func nodeConfiguredForParams(async: @escaping (@escaping () -> Void) -> Void, params: ListViewItemLayoutParams, synchronousLoads: Bool, previousItem: ListViewItem?, nextItem: ListViewItem?, completion: @escaping (ListViewItemNode, @escaping () -> (Signal?, () -> Void)) -> Void) { + func nodeConfiguredForParams(async: @escaping (@escaping () -> Void) -> Void, params: ListViewItemLayoutParams, synchronousLoads: Bool, previousItem: ListViewItem?, nextItem: ListViewItem?, completion: @escaping (ListViewItemNode, @escaping () -> (Signal?, (ListViewItemApply) -> Void)) -> Void) { async { let node = ItemListWebsiteItemNode() let (layout, apply) = node.asyncLayout()(self, params, itemListNeighbors(item: self, topItem: previousItem as? ItemListItem, bottomItem: nextItem as? ItemListItem)) @@ -57,13 +57,13 @@ final class ItemListWebsiteItem: ListViewItem, ItemListItem { Queue.mainQueue().async { completion(node, { - return (nil, { apply(false) }) + return (nil, { _ in apply(false) }) }) } } } - func updateNode(async: @escaping (@escaping () -> Void) -> Void, node: @escaping () -> ListViewItemNode, params: ListViewItemLayoutParams, previousItem: ListViewItem?, nextItem: ListViewItem?, animation: ListViewItemUpdateAnimation, completion: @escaping (ListViewItemNodeLayout, @escaping () -> Void) -> Void) { + func updateNode(async: @escaping (@escaping () -> Void) -> Void, node: @escaping () -> ListViewItemNode, params: ListViewItemLayoutParams, previousItem: ListViewItem?, nextItem: ListViewItem?, animation: ListViewItemUpdateAnimation, completion: @escaping (ListViewItemNodeLayout, @escaping (ListViewItemApply) -> Void) -> Void) { Queue.mainQueue().async { if let nodeValue = node() as? ItemListWebsiteItemNode { let makeLayout = nodeValue.asyncLayout() @@ -76,7 +76,7 @@ final class ItemListWebsiteItem: ListViewItem, ItemListItem { async { let (layout, apply) = makeLayout(self, params, itemListNeighbors(item: self, topItem: previousItem as? ItemListItem, bottomItem: nextItem as? ItemListItem)) Queue.mainQueue().async { - completion(layout, { + completion(layout, { _ in apply(animated) }) } diff --git a/TelegramUI/LegacyAvatarPicker.swift b/TelegramUI/LegacyAvatarPicker.swift index e225c42816..3ba161c40e 100644 --- a/TelegramUI/LegacyAvatarPicker.swift +++ b/TelegramUI/LegacyAvatarPicker.swift @@ -3,7 +3,7 @@ import Display import SwiftSignalKit import LegacyComponents -func presentLegacyAvatarPicker(holder: Atomic, signup: Bool, theme: PresentationTheme, present: (ViewController, Any?) -> Void, completion: @escaping (UIImage) -> Void) { +func presentLegacyAvatarPicker(holder: Atomic, signup: Bool, theme: PresentationTheme, present: (ViewController, Any?) -> Void, openCurrent: (() -> Void)?, completion: @escaping (UIImage) -> Void) { let legacyController = LegacyController(presentation: .custom, theme: theme) legacyController.statusBar.statusBarStyle = .Ignore @@ -16,7 +16,7 @@ func presentLegacyAvatarPicker(holder: Atomic, signup: Bool, theme: P present(legacyController, nil) - let mixin = TGMediaAvatarMenuMixin(context: legacyController.context, parentController: emptyController, hasDeleteButton: false, hasViewButton: false, personalPhoto: true, saveEditedPhotos: false, saveCapturedMedia: false, signup: signup)! + let mixin = TGMediaAvatarMenuMixin(context: legacyController.context, parentController: emptyController, hasDeleteButton: false, hasViewButton: openCurrent != nil, personalPhoto: true, saveEditedPhotos: false, saveCapturedMedia: false, signup: signup)! let _ = holder.swap(mixin) mixin.didFinishWithImage = { image in guard let image = image else { @@ -24,6 +24,9 @@ func presentLegacyAvatarPicker(holder: Atomic, signup: Bool, theme: P } completion(image) } + mixin.didFinishWithView = { [weak legacyController] in + openCurrent?() + } mixin.didDismiss = { [weak legacyController] in let _ = holder.swap(nil) legacyController?.dismiss() diff --git a/TelegramUI/LegacyCamera.swift b/TelegramUI/LegacyCamera.swift index 6e4ed54f4f..f63da3863b 100644 --- a/TelegramUI/LegacyCamera.swift +++ b/TelegramUI/LegacyCamera.swift @@ -26,8 +26,8 @@ func presentedLegacyCamera(account: Account, peer: Peer, cameraView: TGAttachmen if #available(iOSApplicationExtension 11.0, *) { } else { - controller.customPresentOverlayController = { [weak legacyController] overlayController in - guard let legacyController = legacyController, let overlayController = overlayController else { + controller.customPresentOverlayController = { [weak legacyController] generateController in + guard let legacyController = legacyController, let generateController = generateController else { return } @@ -35,6 +35,9 @@ func presentedLegacyCamera(account: Account, peer: Peer, cameraView: TGAttachmen let overlayLegacyController = LegacyController(presentation: .custom, theme: presentationData.theme) overlayLegacyController.supportedOrientations = ViewControllerSupportedOrientations(regularSize: .portrait, compactSize: .portrait) overlayLegacyController.statusBar.statusBarStyle = .Hide + + let overlayController = generateController(overlayLegacyController.context)! + overlayLegacyController.bind(controller: overlayController) overlayController.customDismissSelf = { [weak overlayLegacyController] in overlayLegacyController?.dismiss() diff --git a/TelegramUI/LegacyController.swift b/TelegramUI/LegacyController.swift index b9bb54d0a7..cd99c1235a 100644 --- a/TelegramUI/LegacyController.swift +++ b/TelegramUI/LegacyController.swift @@ -339,6 +339,9 @@ public class LegacyController: ViewController { self.contextImpl = contextImpl } + deinit { + } + required public init(coder aDecoder: NSCoder) { fatalError("init(coder:) has not been implemented") } diff --git a/TelegramUI/LegacyMediaPickers.swift b/TelegramUI/LegacyMediaPickers.swift index f5a40a5514..566da6c682 100644 --- a/TelegramUI/LegacyMediaPickers.swift +++ b/TelegramUI/LegacyMediaPickers.swift @@ -263,13 +263,14 @@ func legacyAssetPickerEnqueueMessages(account: Account, signals: [Any]) -> Signa var randomId: Int64 = 0 arc4random_buf(&randomId, 8) let tempFilePath = NSTemporaryDirectory() + "\(randomId).jpeg" - let scaledSize = image.size.aspectFitted(CGSize(width: 1280.0, height: 1280.0)) + let scaledSize = image.size.aspectFittedOrSmaller(CGSize(width: 1280.0, height: 1280.0)) if let scaledImage = TGScaleImageToPixelSize(image, scaledSize) { if let scaledImageData = compressImageToJPEG(scaledImage, quality: 0.6) { let _ = try? scaledImageData.write(to: URL(fileURLWithPath: tempFilePath)) #if DEBUG if #available(iOSApplicationExtension 11.0, *) { if false, let heicData = compressImage(scaledImage, quality: 0.65) { + print("scaledImageData \(scaledImageData.count), heicData \(heicData.count)") var randomId: Int64 = 0 arc4random_buf(&randomId, 8) let _ = try? heicData.write(to: URL(fileURLWithPath: tempFilePath + ".heic")) @@ -292,14 +293,22 @@ func legacyAssetPickerEnqueueMessages(account: Account, signals: [Any]) -> Signa if let timer = item.timer, timer > 0 && timer <= 60 { attributes.append(AutoremoveTimeoutMessageAttribute(timeout: Int32(timer), countdownBeginTime: nil)) } - messages.append(.message(text: caption ?? "", attributes: attributes, mediaReference: .standalone(media: media), replyToMessageId: nil, localGroupingKey: item.groupedId)) + + var text = caption ?? "" + if text.isEmpty && GlobalExperimentalSettings.enableTinyThumbnails { + if let tinyThumbnail = compressTinyThumbnail(scaledImage) { + text = serializeTinyThumbnail(tinyThumbnail) + } + } + + messages.append(.message(text: text, attributes: attributes, mediaReference: .standalone(media: media), replyToMessageId: nil, localGroupingKey: item.groupedId)) } } case let .asset(asset): var randomId: Int64 = 0 arc4random_buf(&randomId, 8) let size = CGSize(width: CGFloat(asset.pixelWidth), height: CGFloat(asset.pixelHeight)) - let scaledSize = size.aspectFitted(CGSize(width: 1280.0, height: 1280.0)) + let scaledSize = size.aspectFittedOrSmaller(CGSize(width: 1280.0, height: 1280.0)) let resource = PhotoLibraryMediaResource(localIdentifier: asset.localIdentifier, uniqueId: arc4random64()) representations.append(TelegramMediaImageRepresentation(dimensions: scaledSize, resource: resource)) diff --git a/TelegramUI/LegacySuggestionContext.swift b/TelegramUI/LegacySuggestionContext.swift index f485c33bea..834c991ba9 100644 --- a/TelegramUI/LegacySuggestionContext.swift +++ b/TelegramUI/LegacySuggestionContext.swift @@ -2,14 +2,16 @@ import Foundation import TelegramCore import Postbox import SwiftSignalKit + +import TelegramUIPrivateModule import LegacyComponents func legacySuggestionContext(account: Account, peerId: PeerId) -> TGSuggestionContext { let context = TGSuggestionContext() - context.userListSignal = { mention in + context.userListSignal = { query in return SSignal { subscriber in - if let mention = mention { - let normalizedQuery = mention.lowercased() + if let query = query { + let normalizedQuery = query.lowercased() let disposable = peerParticipants(postbox: account.postbox, id: peerId).start(next: { peers in let filteredPeers = peers.filter { peer in if peer.indexName.matchesByTokens(normalizedQuery) { @@ -54,5 +56,37 @@ func legacySuggestionContext(account: Account, peerId: PeerId) -> TGSuggestionCo } } } + context.hashtagListSignal = { query in + return SSignal { subscriber in + let disposable = (recentlyUsedHashtags(postbox: account.postbox) |> map { hashtags -> [String] in + let normalizedQuery = query?.lowercased() + var result: [String] = [] + if let normalizedQuery = normalizedQuery { + for hashtag in hashtags { + if hashtag.lowercased().hasPrefix(normalizedQuery) { + result.append(hashtag) + } + } + } + return result + } + |> take(1) + |> deliverOnMainQueue).start(next: { hashtags in + subscriber?.putNext(hashtags) + subscriber?.putCompletion() + }) + + return SBlockDisposable { + disposable.dispose() + } + } + } + context.alphacodeSignal = { query in + return SSignal { subscriber in + subscriber?.putNext(TGEmojiSuggestions.suggestions(forQuery: query?.lowercased())) + subscriber?.putCompletion() + return nil + } + } return context } diff --git a/TelegramUI/ListMessageHoleItem.swift b/TelegramUI/ListMessageHoleItem.swift index f8a97bd7ba..9d1a6cf67c 100644 --- a/TelegramUI/ListMessageHoleItem.swift +++ b/TelegramUI/ListMessageHoleItem.swift @@ -9,7 +9,7 @@ final class ListMessageHoleItem: ListViewItem { public init() { } - public func nodeConfiguredForParams(async: @escaping (@escaping () -> Void) -> Void, params: ListViewItemLayoutParams, synchronousLoads: Bool, previousItem: ListViewItem?, nextItem: ListViewItem?, completion: @escaping (ListViewItemNode, @escaping () -> (Signal?, () -> Void)) -> Void) { + public func nodeConfiguredForParams(async: @escaping (@escaping () -> Void) -> Void, params: ListViewItemLayoutParams, synchronousLoads: Bool, previousItem: ListViewItem?, nextItem: ListViewItem?, completion: @escaping (ListViewItemNode, @escaping () -> (Signal?, (ListViewItemApply) -> Void)) -> Void) { let configure = { () -> Void in let node = ListMessageHoleItemNode() @@ -24,7 +24,7 @@ final class ListMessageHoleItem: ListViewItem { Queue.mainQueue().async { completion(node, { - return (nil, { apply(.None) }) + return (nil, { _ in apply(.None) }) }) } } @@ -37,7 +37,7 @@ final class ListMessageHoleItem: ListViewItem { } } - public func updateNode(async: @escaping (@escaping () -> Void) -> Void, node: @escaping () -> ListViewItemNode, params: ListViewItemLayoutParams, previousItem: ListViewItem?, nextItem: ListViewItem?, animation: ListViewItemUpdateAnimation, completion: @escaping (ListViewItemNodeLayout, @escaping () -> Void) -> Void) { + public func updateNode(async: @escaping (@escaping () -> Void) -> Void, node: @escaping () -> ListViewItemNode, params: ListViewItemLayoutParams, previousItem: ListViewItem?, nextItem: ListViewItem?, animation: ListViewItemUpdateAnimation, completion: @escaping (ListViewItemNodeLayout, @escaping (ListViewItemApply) -> Void) -> Void) { Queue.mainQueue().async { if let nodeValue = node() as? ListMessageHoleItemNode { nodeValue.updateSelectionState(animated: false) @@ -49,7 +49,7 @@ final class ListMessageHoleItem: ListViewItem { let (layout, apply) = nodeLayout(self, params, top, bottom, dateAtBottom) Queue.mainQueue().async { - completion(layout, { + completion(layout, { _ in apply(animation) }) } diff --git a/TelegramUI/ListMessageItem.swift b/TelegramUI/ListMessageItem.swift index e7c9fb1888..4b3b1f3efe 100644 --- a/TelegramUI/ListMessageItem.swift +++ b/TelegramUI/ListMessageItem.swift @@ -35,7 +35,7 @@ final class ListMessageItem: ListViewItem { self.selection = selection } - public func nodeConfiguredForParams(async: @escaping (@escaping () -> Void) -> Void, params: ListViewItemLayoutParams, synchronousLoads: Bool, previousItem: ListViewItem?, nextItem: ListViewItem?, completion: @escaping (ListViewItemNode, @escaping () -> (Signal?, () -> Void)) -> Void) { + public func nodeConfiguredForParams(async: @escaping (@escaping () -> Void) -> Void, params: ListViewItemLayoutParams, synchronousLoads: Bool, previousItem: ListViewItem?, nextItem: ListViewItem?, completion: @escaping (ListViewItemNode, @escaping () -> (Signal?, (ListViewItemApply) -> Void)) -> Void) { var viewClassName: AnyClass = ListMessageSnippetItemNode.self for media in message.media { @@ -61,7 +61,7 @@ final class ListMessageItem: ListViewItem { Queue.mainQueue().async { completion(node, { - return (nil, { apply(.None) }) + return (nil, { _ in apply(.None) }) }) } } @@ -74,7 +74,7 @@ final class ListMessageItem: ListViewItem { } } - public func updateNode(async: @escaping (@escaping () -> Void) -> Void, node: @escaping () -> ListViewItemNode, params: ListViewItemLayoutParams, previousItem: ListViewItem?, nextItem: ListViewItem?, animation: ListViewItemUpdateAnimation, completion: @escaping (ListViewItemNodeLayout, @escaping () -> Void) -> Void) { + public func updateNode(async: @escaping (@escaping () -> Void) -> Void, node: @escaping () -> ListViewItemNode, params: ListViewItemLayoutParams, previousItem: ListViewItem?, nextItem: ListViewItem?, animation: ListViewItemUpdateAnimation, completion: @escaping (ListViewItemNodeLayout, @escaping (ListViewItemApply) -> Void) -> Void) { Queue.mainQueue().async { if let nodeValue = node() as? ListMessageNode { nodeValue.setupItem(self) @@ -88,7 +88,7 @@ final class ListMessageItem: ListViewItem { let (layout, apply) = nodeLayout(self, params, top, bottom, dateAtBottom) Queue.mainQueue().async { - completion(layout, { + completion(layout, { _ in apply(animation) }) } diff --git a/TelegramUI/LocalizationListControllerNode.swift b/TelegramUI/LocalizationListControllerNode.swift index 2c5310eb7d..fa7be02839 100644 --- a/TelegramUI/LocalizationListControllerNode.swift +++ b/TelegramUI/LocalizationListControllerNode.swift @@ -53,7 +53,7 @@ private enum LanguageListEntry: Comparable, Identifiable { openSearch() }) case let .localization(_, info, type, selected, activity, revealed, editing): - return LocalizationListItem(theme: theme, strings: strings, id: info.languageCode, title: info.title, subtitle: info.localizedTitle, checked: selected, activity: activity, editing: LocalizationListItemEditing(editable: !searchMode && !info.isOfficial, editing: editing, revealed: revealed, reorderable: false), sectionId: type == .official ? LanguageListSection.official.rawValue : LanguageListSection.unofficial.rawValue, alwaysPlain: searchMode, action: { + return LocalizationListItem(theme: theme, strings: strings, id: info.languageCode, title: info.title, subtitle: info.localizedTitle, checked: selected, activity: activity, editing: LocalizationListItemEditing(editable: !selected && !searchMode && !info.isOfficial, editing: editing, revealed: !selected && revealed, reorderable: false), sectionId: type == .official ? LanguageListSection.official.rawValue : LanguageListSection.unofficial.rawValue, alwaysPlain: searchMode, action: { selectLocalization(info) }, setItemWithRevealedOptions: setItemWithRevealedOptions, removeItem: removeItem) } diff --git a/TelegramUI/LocalizationListItem.swift b/TelegramUI/LocalizationListItem.swift index 26abd42081..2a3e5c7841 100644 --- a/TelegramUI/LocalizationListItem.swift +++ b/TelegramUI/LocalizationListItem.swift @@ -41,7 +41,7 @@ class LocalizationListItem: ListViewItem, ItemListItem { self.removeItem = removeItem } - func nodeConfiguredForParams(async: @escaping (@escaping () -> Void) -> Void, params: ListViewItemLayoutParams, synchronousLoads: Bool, previousItem: ListViewItem?, nextItem: ListViewItem?, completion: @escaping (ListViewItemNode, @escaping () -> (Signal?, () -> Void)) -> Void) { + func nodeConfiguredForParams(async: @escaping (@escaping () -> Void) -> Void, params: ListViewItemLayoutParams, synchronousLoads: Bool, previousItem: ListViewItem?, nextItem: ListViewItem?, completion: @escaping (ListViewItemNode, @escaping () -> (Signal?, (ListViewItemApply) -> Void)) -> Void) { async { let node = LocalizationListItemNode() var neighbors = itemListNeighbors(item: self, topItem: previousItem as? ItemListItem, bottomItem: nextItem as? ItemListItem) @@ -55,13 +55,13 @@ class LocalizationListItem: ListViewItem, ItemListItem { Queue.mainQueue().async { completion(node, { - return (nil, { apply(false) }) + return (nil, { _ in apply(false) }) }) } } } - func updateNode(async: @escaping (@escaping () -> Void) -> Void, node: @escaping () -> ListViewItemNode, params: ListViewItemLayoutParams, previousItem: ListViewItem?, nextItem: ListViewItem?, animation: ListViewItemUpdateAnimation, completion: @escaping (ListViewItemNodeLayout, @escaping () -> Void) -> Void) { + func updateNode(async: @escaping (@escaping () -> Void) -> Void, node: @escaping () -> ListViewItemNode, params: ListViewItemLayoutParams, previousItem: ListViewItem?, nextItem: ListViewItem?, animation: ListViewItemUpdateAnimation, completion: @escaping (ListViewItemNodeLayout, @escaping (ListViewItemApply) -> Void) -> Void) { Queue.mainQueue().async { if let nodeValue = node() as? LocalizationListItemNode { let makeLayout = nodeValue.asyncLayout() @@ -73,7 +73,7 @@ class LocalizationListItem: ListViewItem, ItemListItem { } let (layout, apply) = makeLayout(self, params, neighbors) Queue.mainQueue().async { - completion(layout, { + completion(layout, { _ in apply(animation.isAnimated) }) } diff --git a/TelegramUI/ManagedAudioRecorder.swift b/TelegramUI/ManagedAudioRecorder.swift index 48296d985f..7ffac34d92 100644 --- a/TelegramUI/ManagedAudioRecorder.swift +++ b/TelegramUI/ManagedAudioRecorder.swift @@ -161,9 +161,10 @@ final class ManagedAudioRecorderContext { private let audioUnit = Atomic(value: nil) - private var waveformSamples = Data() - private var waveformPeak: Int16 = 0 - private var waveformPeakCount: Int = 0 + private var compressedWaveformSamples = Data() + private var currentPeak: Int64 = 0 + private var currentPeakCount: Int = 0 + private var peakCompressionFactor: Int = 1 private var micLevelPeak: Int16 = 0 private var micLevelPeakCount: Int = 0 @@ -175,9 +176,9 @@ final class ManagedAudioRecorderContext { private var hasAudioSession = false private var audioSessionDisposable: Disposable? - private var tonePlayer: TonePlayer? - //private var toneRenderer: MediaPlayerAudioRenderer? - //private var toneRendererAudioSession: MediaPlayerAudioSessionCustomControl? + //private var tonePlayer: TonePlayer? + private var toneRenderer: MediaPlayerAudioRenderer? + private var toneRendererAudioSession: MediaPlayerAudioSessionCustomControl? private var toneRendererAudioSessionActivated = false private var processSamples = false @@ -200,7 +201,7 @@ final class ManagedAudioRecorderContext { self.dataItem = TGDataItem() self.oggWriter = TGOggOpusWriter() - /*if false, let toneData = audioRecordingToneData { + if beginWithTone, let toneData = audioRecordingToneData { self.processSamples = false let toneRenderer = MediaPlayerAudioRenderer(audioSession: .custom({ [weak self] control in queue.async { @@ -286,9 +287,9 @@ final class ManagedAudioRecorderContext { toneTimer.start() } else { self.processSamples = true - }*/ + } - if beginWithTone, let beginToneData = beginToneData { + /*if beginWithTone, let beginToneData = beginToneData { self.tonePlayer = TonePlayer() self.tonePlayer?.play(data: beginToneData, completed: { [weak self] in queue.async { @@ -307,7 +308,7 @@ final class ManagedAudioRecorderContext { }) } else { self.processSamples = true - } + }*/ addAudioRecorderContext(self.id, self) addAudioUnitHolder(self.id, queue, self.audioUnit) @@ -331,7 +332,7 @@ final class ManagedAudioRecorderContext { self.audioSessionDisposable?.dispose() - //self.toneRenderer?.stop() + self.toneRenderer?.stop() self.toneTimer?.invalidate() } @@ -396,7 +397,7 @@ final class ManagedAudioRecorderContext { if self.audioSessionDisposable == nil { let queue = self.queue - self.audioSessionDisposable = self.mediaManager.audioSession.push(audioSessionType: .record, activate: { [weak self] state in + self.audioSessionDisposable = self.mediaManager.audioSession.push(audioSessionType: .record(speaker: self.beginWithTone), activate: { [weak self] state in queue.async { if let strongSelf = self, !strongSelf.paused { strongSelf.hasAudioSession = true @@ -409,6 +410,7 @@ final class ManagedAudioRecorderContext { if let strongSelf = self { strongSelf.hasAudioSession = false strongSelf.stop() + strongSelf.recordingState.set(.stopped) subscriber.putCompletion() } } @@ -420,12 +422,13 @@ final class ManagedAudioRecorderContext { } func audioSessionAcquired(headset: Bool) { - if let tonePlayer = self.tonePlayer, headset || self.beginWithTone { + if let toneRenderer = self.toneRenderer, headset || self.beginWithTone { self.beganWithTone(true) if !self.toneRendererAudioSessionActivated { self.toneRendererAudioSessionActivated = true - tonePlayer.start() + self.toneRendererAudioSession?.activate() } + toneRenderer.setRate(1.0) } else { self.processSamples = true self.beganWithTone(false) @@ -463,9 +466,9 @@ final class ManagedAudioRecorderContext { } } - if let tonePlayer = self.tonePlayer, self.toneRendererAudioSessionActivated { + if let toneRenderer = self.toneRenderer, self.toneRendererAudioSessionActivated { self.toneRendererAudioSessionActivated = false - tonePlayer.stop() + toneRenderer.stop() } let audioSessionDisposable = self.audioSessionDisposable @@ -525,8 +528,6 @@ final class ManagedAudioRecorderContext { self.audioBuffer.append(currentEncoderPacket.assumingMemoryBound(to: UInt8.self), count: currentEncoderPacketSize) break } else { - let previousBytesWritten = self.oggWriter.encodedBytes() - self.processWaveformPreview(samples: currentEncoderPacket.assumingMemoryBound(to: Int16.self), count: currentEncoderPacketSize / 2) self.oggWriter.writeFrame(currentEncoderPacket.assumingMemoryBound(to: UInt8.self), frameByteCount: UInt(currentEncoderPacketSize)) @@ -536,16 +537,6 @@ final class ManagedAudioRecorderContext { self.recordingStateUpdateTimestamp = timestamp self.recordingState.set(.recording(duration: oggWriter.encodedDuration(), durationMediaTimestamp: timestamp)) } - - /*NSUInteger currentBytesWritten = [_oggWriter encodedBytes]; - if (currentBytesWritten != previousBytesWritten) - { - [ActionStageInstance() dispatchOnStageQueue:^ - { - TGLiveUploadActor *actor = (TGLiveUploadActor *)[ActionStageInstance() executingActorWithPath:_liveUploadPath]; - [actor updateSize:currentBytesWritten]; - }]; - }*/ } } } @@ -560,19 +551,28 @@ final class ManagedAudioRecorderContext { sample = -sample } } - if self.waveformPeak < sample { - self.waveformPeak = sample - } - self.waveformPeakCount += 1 - if self.waveformPeakCount >= 100 { - self.waveformSamples.count += 2 - var waveformPeak = self.waveformPeak - withUnsafeBytes(of: &waveformPeak, { bytes -> Void in - self.waveformSamples.append(bytes.baseAddress!.assumingMemoryBound(to: UInt8.self), count: 2) + self.currentPeak = max(Int64(sample), self.currentPeak) + self.currentPeakCount += 1 + if self.currentPeakCount == self.peakCompressionFactor { + var compressedPeak = self.currentPeak//Int16(Float(self.currentPeak) / Float(self.peakCompressionFactor)) + withUnsafeBytes(of: &compressedPeak, { buffer in + self.compressedWaveformSamples.append(buffer.bindMemory(to: UInt8.self)) }) - self.waveformPeak = 0 - self.waveformPeakCount = 0 + self.currentPeak = 0 + self.currentPeakCount = 0 + + let compressedSampleCount = self.compressedWaveformSamples.count / 2 + if compressedSampleCount == 200 { + self.compressedWaveformSamples.withUnsafeMutableBytes { (compressedSamples: UnsafeMutablePointer) -> Void in + for i in 0 ..< 100 { + let maxSample = Int64(max(compressedSamples[i * 2 + 0], compressedSamples[i * 2 + 1])) + compressedSamples[i] = Int16(maxSample) + } + } + self.compressedWaveformSamples.count = 100 * 2 + self.peakCompressionFactor *= 2 + } } if self.micLevelPeak < sample { @@ -599,8 +599,8 @@ final class ManagedAudioRecorderContext { memset(scaledSamples, 0, 100 * 2); var waveform: Data? - let count = self.waveformSamples.count / 2 - self.waveformSamples.withUnsafeMutableBytes { (samples: UnsafeMutablePointer) -> Void in + let count = self.compressedWaveformSamples.count / 2 + self.compressedWaveformSamples.withUnsafeMutableBytes { (samples: UnsafeMutablePointer) -> Void in for i in 0 ..< count { let sample = samples[i] let index = i * 100 / count @@ -616,7 +616,7 @@ final class ManagedAudioRecorderContext { if peak < sample { peak = sample } - sumSamples += Int64(peak) + sumSamples += Int64(sample) } var calculatedPeak: UInt16 = 0 calculatedPeak = UInt16((Double(sumSamples) * 1.8 / 100.0)) @@ -627,12 +627,12 @@ final class ManagedAudioRecorderContext { for i in 0 ..< 100 { let sample: UInt16 = UInt16(Int64(scaledSamples[i])) - if sample > calculatedPeak { - scaledSamples[i] = Int16(calculatedPeak) - } + let minPeak = min(Int64(sample), Int64(calculatedPeak)) + let resultPeak = minPeak * 31 / Int64(calculatedPeak) + scaledSamples[i] = Int16(clamping: min(31, resultPeak)) } - let resultWaveform = AudioWaveform(samples: Data(bytes: scaledSamplesMemory, count: 100 * 2), peak: Int32(calculatedPeak)) + let resultWaveform = AudioWaveform(samples: Data(bytes: scaledSamplesMemory, count: 100 * 2), peak: 31) let bitstream = resultWaveform.makeBitstream() waveform = AudioWaveform(bitstream: bitstream, bitsPerSample: 5).makeBitstream() } @@ -647,23 +647,7 @@ final class ManagedAudioRecorderContext { enum AudioRecordingState: Equatable { case paused(duration: Double) case recording(duration: Double, durationMediaTimestamp: Double) - - static func ==(lhs: AudioRecordingState, rhs: AudioRecordingState) -> Bool { - switch lhs { - case let .paused(duration): - if case .paused(duration) = rhs { - return true - } else { - return false - } - case let .recording(duration, durationMediaTimestamp): - if case .recording(duration, durationMediaTimestamp) = rhs { - return true - } else { - return false - } - } - } + case stopped } final class ManagedAudioRecorder { diff --git a/TelegramUI/ManagedAudioSession.swift b/TelegramUI/ManagedAudioSession.swift index ce802a0a31..517e81bca5 100644 --- a/TelegramUI/ManagedAudioSession.swift +++ b/TelegramUI/ManagedAudioSession.swift @@ -3,10 +3,10 @@ import SwiftSignalKit import AVFoundation import UIKit -enum ManagedAudioSessionType { +enum ManagedAudioSessionType: Equatable { case play case playWithPossiblePortOverride - case record + case record(speaker: Bool) case voiceCall } @@ -544,7 +544,17 @@ public final class ManagedAudioSession { private func applyNoneDelayed() { self.deactivateTimer?.invalidate() - if self.currentTypeAndOutputMode?.0 == .voiceCall || self.currentTypeAndOutputMode?.0 == .record { + var immediately = false + if let mode = self.currentTypeAndOutputMode?.0 { + switch mode { + case .voiceCall, .record: + immediately = true + default: + break + } + } + + if immediately { self.applyNone() } else { let deactivateTimer = SwiftSignalKit.Timer(timeout: 1.0, repeat: false, completion: { [weak self] in @@ -696,22 +706,22 @@ public final class ManagedAudioSession { } } if resetToBuiltin { - try AVAudioSession.sharedInstance().overrideOutputAudioPort(.none) switch type { case .voiceCall, .playWithPossiblePortOverride, .record: + try AVAudioSession.sharedInstance().overrideOutputAudioPort(.none) if let routes = AVAudioSession.sharedInstance().availableInputs { for route in routes { if route.portType == AVAudioSessionPortBuiltInMic { - if type == .record && self.isHeadsetPluggedInValue { + if case .record = type, self.isHeadsetPluggedInValue { } else { let _ = try? AVAudioSession.sharedInstance().setPreferredInput(route) } break } } - } + } default: - break + try AVAudioSession.sharedInstance().overrideOutputAudioPort(.none) } } } diff --git a/TelegramUI/MapResources.swift b/TelegramUI/MapResources.swift index 0bc93565b7..5b54668f67 100644 --- a/TelegramUI/MapResources.swift +++ b/TelegramUI/MapResources.swift @@ -58,7 +58,7 @@ public class MapSnapshotMediaResource: TelegramMediaResource { return MapSnapshotMediaResourceId(latitude: self.latitude, longitude: self.longitude, width: self.width, height: self.height) } - public func isEqual(to: TelegramMediaResource) -> Bool { + public func isEqual(to: MediaResource) -> Bool { if let to = to as? MapSnapshotMediaResource { return self.latitude == to.latitude && self.longitude == to.longitude && self.width == to.width && self.height == to.height } else { diff --git a/TelegramUI/MediaInputPaneTrendingItem.swift b/TelegramUI/MediaInputPaneTrendingItem.swift index d1bcf0a8b8..b4d7c7a97a 100644 --- a/TelegramUI/MediaInputPaneTrendingItem.swift +++ b/TelegramUI/MediaInputPaneTrendingItem.swift @@ -26,7 +26,7 @@ class MediaInputPaneTrendingItem: ListViewItem { self.unread = unread } - func nodeConfiguredForParams(async: @escaping (@escaping () -> Void) -> Void, params: ListViewItemLayoutParams, synchronousLoads: Bool, previousItem: ListViewItem?, nextItem: ListViewItem?, completion: @escaping (ListViewItemNode, @escaping () -> (Signal?, () -> Void)) -> Void) { + func nodeConfiguredForParams(async: @escaping (@escaping () -> Void) -> Void, params: ListViewItemLayoutParams, synchronousLoads: Bool, previousItem: ListViewItem?, nextItem: ListViewItem?, completion: @escaping (ListViewItemNode, @escaping () -> (Signal?, (ListViewItemApply) -> Void)) -> Void) { async { let node = MediaInputPaneTrendingItemNode() let (layout, apply) = node.asyncLayout()(self, params) @@ -36,13 +36,13 @@ class MediaInputPaneTrendingItem: ListViewItem { Queue.mainQueue().async { completion(node, { - return (nil, { apply() }) + return (nil, { info in apply(synchronousLoads && info.isOnScreen) }) }) } } } - func updateNode(async: @escaping (@escaping () -> Void) -> Void, node: @escaping () -> ListViewItemNode, params: ListViewItemLayoutParams, previousItem: ListViewItem?, nextItem: ListViewItem?, animation: ListViewItemUpdateAnimation, completion: @escaping (ListViewItemNodeLayout, @escaping () -> Void) -> Void) { + func updateNode(async: @escaping (@escaping () -> Void) -> Void, node: @escaping () -> ListViewItemNode, params: ListViewItemLayoutParams, previousItem: ListViewItem?, nextItem: ListViewItem?, animation: ListViewItemUpdateAnimation, completion: @escaping (ListViewItemNodeLayout, @escaping (ListViewItemApply) -> Void) -> Void) { Queue.mainQueue().async { if let nodeValue = node() as? MediaInputPaneTrendingItemNode { let makeLayout = nodeValue.asyncLayout() @@ -50,8 +50,8 @@ class MediaInputPaneTrendingItem: ListViewItem { async { let (layout, apply) = makeLayout(self, params) Queue.mainQueue().async { - completion(layout, { - apply() + completion(layout, { _ in + apply(false) }) } } @@ -168,7 +168,7 @@ class MediaInputPaneTrendingItemNode: ListViewItemNode { self.view.addGestureRecognizer(UITapGestureRecognizer(target: self, action: #selector(self.tapGesture(_:)))) } - func asyncLayout() -> (_ item: MediaInputPaneTrendingItem, _ params: ListViewItemLayoutParams) -> (ListViewItemNodeLayout, () -> Void) { + func asyncLayout() -> (_ item: MediaInputPaneTrendingItem, _ params: ListViewItemLayoutParams) -> (ListViewItemNodeLayout, (Bool) -> Void) { let makeInstallLayout = TextNode.asyncLayout(self.installTextNode) let makeTitleLayout = TextNode.asyncLayout(self.titleNode) let makeDescriptionLayout = TextNode.asyncLayout(self.descriptionNode) @@ -201,7 +201,7 @@ class MediaInputPaneTrendingItemNode: ListViewItemNode { topItems.removeSubrange(5 ..< topItems.count) } - return (layout, { [weak self] in + return (layout, { [weak self] synchronousLoads in if let strongSelf = self { if item.topItems.count < Int(item.info.count) && item.topItems.count < 5 && strongSelf.item?.info.id != item.info.id { strongSelf.preloadDisposable.set(preloadedFeaturedStickerSet(network: item.account.network, postbox: item.account.postbox, id: item.info.id).start()) @@ -267,7 +267,7 @@ class MediaInputPaneTrendingItemNode: ListViewItemNode { } if file.fileId != node.file?.fileId { node.file = file - node.setSignal(chatMessageSticker(account: item.account, file: file, small: true)) + node.setSignal(chatMessageSticker(account: item.account, file: file, small: true, synchronousLoad: synchronousLoads), attemptSynchronously: synchronousLoads) node.loadDisposable.set(freeMediaFileResourceInteractiveFetched(account: item.account, fileReference: stickerPackFileReference(file), resource: chatMessageStickerResource(file: file, small: true)).start()) } if let dimensions = file.dimensions { diff --git a/TelegramUI/MediaManager.swift b/TelegramUI/MediaManager.swift index 5b6da29987..c7a1adc635 100644 --- a/TelegramUI/MediaManager.swift +++ b/TelegramUI/MediaManager.swift @@ -450,6 +450,13 @@ public final class MediaManager: NSObject { strongSelf.voiceMediaPlayer = voiceMediaPlayer voiceMediaPlayer.playedToEnd = { [weak voiceMediaPlayer] in if let strongSelf = self, let voiceMediaPlayer = voiceMediaPlayer, voiceMediaPlayer === strongSelf.voiceMediaPlayer { + voiceMediaPlayer.stop() + strongSelf.voiceMediaPlayer = nil + } + } + voiceMediaPlayer.cancelled = { [weak voiceMediaPlayer] in + if let strongSelf = self, let voiceMediaPlayer = voiceMediaPlayer, voiceMediaPlayer === strongSelf.voiceMediaPlayer { + voiceMediaPlayer.stop() strongSelf.voiceMediaPlayer = nil } } @@ -461,7 +468,14 @@ public final class MediaManager: NSObject { strongSelf.musicMediaPlayer?.stop() strongSelf.voiceMediaPlayer?.control(.playback(.pause)) if let playlist = playlist { - strongSelf.musicMediaPlayer = SharedMediaPlayer(mediaManager: strongSelf, inForeground: strongSelf.inForeground, postbox: strongSelf.postbox, audioSession: strongSelf.audioSession, overlayMediaManager: strongSelf.overlayMediaManager, playlist: playlist, initialOrder: settings.order, initialLooping: settings.looping, initialPlaybackRate: .x1, playerIndex: nextPlayerIndex, controlPlaybackWithProximity: false) + let musicMediaPlayer = SharedMediaPlayer(mediaManager: strongSelf, inForeground: strongSelf.inForeground, postbox: strongSelf.postbox, audioSession: strongSelf.audioSession, overlayMediaManager: strongSelf.overlayMediaManager, playlist: playlist, initialOrder: settings.order, initialLooping: settings.looping, initialPlaybackRate: .x1, playerIndex: nextPlayerIndex, controlPlaybackWithProximity: false) + strongSelf.musicMediaPlayer = musicMediaPlayer + musicMediaPlayer.cancelled = { [weak musicMediaPlayer] in + if let strongSelf = self, let musicMediaPlayer = musicMediaPlayer, musicMediaPlayer === strongSelf.musicMediaPlayer { + musicMediaPlayer.stop() + strongSelf.musicMediaPlayer = nil + } + } strongSelf.musicMediaPlayer?.control(.playback(.play)) } else { strongSelf.musicMediaPlayer = nil diff --git a/TelegramUI/MediaResources.swift b/TelegramUI/MediaResources.swift index 21bad74707..b5c997ab95 100644 --- a/TelegramUI/MediaResources.swift +++ b/TelegramUI/MediaResources.swift @@ -132,7 +132,7 @@ public final class VideoLibraryMediaResource: TelegramMediaResource { return VideoLibraryMediaResourceId(localIdentifier: self.localIdentifier, adjustmentsDigest: adjustmentsDigest) } - public func isEqual(to: TelegramMediaResource) -> Bool { + public func isEqual(to: MediaResource) -> Bool { if let to = to as? VideoLibraryMediaResource { return self.localIdentifier == to.localIdentifier && self.conversion == to.conversion } else { @@ -196,7 +196,7 @@ public final class LocalFileVideoMediaResource: TelegramMediaResource { return LocalFileVideoMediaResourceId(randomId: self.randomId) } - public func isEqual(to: TelegramMediaResource) -> Bool { + public func isEqual(to: MediaResource) -> Bool { if let to = to as? LocalFileVideoMediaResource { return self.randomId == to.randomId && self.path == to.path && self.adjustments == to.adjustments } else { @@ -253,7 +253,7 @@ public class PhotoLibraryMediaResource: TelegramMediaResource { return PhotoLibraryMediaResourceId(localIdentifier: self.localIdentifier, resourceId: self.uniqueId) } - public func isEqual(to: TelegramMediaResource) -> Bool { + public func isEqual(to: MediaResource) -> Bool { if let to = to as? PhotoLibraryMediaResource { return self.localIdentifier == to.localIdentifier && self.uniqueId == to.uniqueId } else { @@ -309,7 +309,7 @@ public final class LocalFileGifMediaResource: TelegramMediaResource { return LocalFileGifMediaResourceId(randomId: self.randomId) } - public func isEqual(to: TelegramMediaResource) -> Bool { + public func isEqual(to: MediaResource) -> Bool { if let to = to as? LocalFileGifMediaResource { return self.randomId == to.randomId && self.path == to.path } else { diff --git a/TelegramUI/MentionChatInputPanelItem.swift b/TelegramUI/MentionChatInputPanelItem.swift index f1c2bd28dd..164ec888b0 100644 --- a/TelegramUI/MentionChatInputPanelItem.swift +++ b/TelegramUI/MentionChatInputPanelItem.swift @@ -22,7 +22,7 @@ final class MentionChatInputPanelItem: ListViewItem { self.peerSelected = peerSelected } - public func nodeConfiguredForParams(async: @escaping (@escaping () -> Void) -> Void, params: ListViewItemLayoutParams, synchronousLoads: Bool, previousItem: ListViewItem?, nextItem: ListViewItem?, completion: @escaping (ListViewItemNode, @escaping () -> (Signal?, () -> Void)) -> Void) { + public func nodeConfiguredForParams(async: @escaping (@escaping () -> Void) -> Void, params: ListViewItemLayoutParams, synchronousLoads: Bool, previousItem: ListViewItem?, nextItem: ListViewItem?, completion: @escaping (ListViewItemNode, @escaping () -> (Signal?, (ListViewItemApply) -> Void)) -> Void) { let configure = { () -> Void in let node = MentionChatInputPanelItemNode() @@ -35,7 +35,7 @@ final class MentionChatInputPanelItem: ListViewItem { Queue.mainQueue().async { completion(node, { - return (nil, { apply(.None) }) + return (nil, { _ in apply(.None) }) }) } } @@ -48,7 +48,7 @@ final class MentionChatInputPanelItem: ListViewItem { } } - public func updateNode(async: @escaping (@escaping () -> Void) -> Void, node: @escaping () -> ListViewItemNode, params: ListViewItemLayoutParams, previousItem: ListViewItem?, nextItem: ListViewItem?, animation: ListViewItemUpdateAnimation, completion: @escaping (ListViewItemNodeLayout, @escaping () -> Void) -> Void) { + public func updateNode(async: @escaping (@escaping () -> Void) -> Void, node: @escaping () -> ListViewItemNode, params: ListViewItemLayoutParams, previousItem: ListViewItem?, nextItem: ListViewItem?, animation: ListViewItemUpdateAnimation, completion: @escaping (ListViewItemNodeLayout, @escaping (ListViewItemApply) -> Void) -> Void) { Queue.mainQueue().async { if let nodeValue = node() as? MentionChatInputPanelItemNode { let nodeLayout = nodeValue.asyncLayout() @@ -58,7 +58,7 @@ final class MentionChatInputPanelItem: ListViewItem { let (layout, apply) = nodeLayout(self, params, top, bottom) Queue.mainQueue().async { - completion(layout, { + completion(layout, { _ in apply(animation) }) } diff --git a/TelegramUI/NotificationSearchItem.swift b/TelegramUI/NotificationSearchItem.swift index ae94ef9968..7f8475bd6c 100644 --- a/TelegramUI/NotificationSearchItem.swift +++ b/TelegramUI/NotificationSearchItem.swift @@ -30,7 +30,7 @@ class NotificationSearchItem: ListViewItem, ItemListItem { self.activate = activate } - func nodeConfiguredForParams(async: @escaping (@escaping () -> Void) -> Void, params: ListViewItemLayoutParams, synchronousLoads: Bool, previousItem: ListViewItem?, nextItem: ListViewItem?, completion: @escaping (ListViewItemNode, @escaping () -> (Signal?, () -> Void)) -> Void) { + func nodeConfiguredForParams(async: @escaping (@escaping () -> Void) -> Void, params: ListViewItemLayoutParams, synchronousLoads: Bool, previousItem: ListViewItem?, nextItem: ListViewItem?, completion: @escaping (ListViewItemNode, @escaping () -> (Signal?, (ListViewItemApply) -> Void)) -> Void) { async { let node = NotificationSearchItemNode() node.placeholder = self.placeholder @@ -44,7 +44,7 @@ class NotificationSearchItem: ListViewItem, ItemListItem { node.activate = self.activate Queue.mainQueue().async { completion(node, { - return (nil, { + return (nil, { _ in apply(false) }) }) @@ -52,14 +52,14 @@ class NotificationSearchItem: ListViewItem, ItemListItem { } } - func updateNode(async: @escaping (@escaping () -> Void) -> Void, node: @escaping () -> ListViewItemNode, params: ListViewItemLayoutParams, previousItem: ListViewItem?, nextItem: ListViewItem?, animation: ListViewItemUpdateAnimation, completion: @escaping (ListViewItemNodeLayout, @escaping () -> Void) -> Void) { + func updateNode(async: @escaping (@escaping () -> Void) -> Void, node: @escaping () -> ListViewItemNode, params: ListViewItemLayoutParams, previousItem: ListViewItem?, nextItem: ListViewItem?, animation: ListViewItemUpdateAnimation, completion: @escaping (ListViewItemNodeLayout, @escaping (ListViewItemApply) -> Void) -> Void) { Queue.mainQueue().async { if let nodeValue = node() as? NotificationSearchItemNode { let layout = nodeValue.asyncLayout() async { let (nodeLayout, apply) = layout(self, params) Queue.mainQueue().async { - completion(nodeLayout, { + completion(nodeLayout, { _ in apply(animation.isAnimated) }) } diff --git a/TelegramUI/NotificationsAndSounds.swift b/TelegramUI/NotificationsAndSounds.swift index 9fed027877..3004b1dca1 100644 --- a/TelegramUI/NotificationsAndSounds.swift +++ b/TelegramUI/NotificationsAndSounds.swift @@ -79,7 +79,7 @@ private enum NotificationsAndSoundsSection: Int32 { } private enum NotificationsAndSoundsEntry: ItemListNodeEntry { - case permissionInfo(PresentationTheme, PresentationStrings) + case permissionInfo(PresentationTheme, PresentationStrings, AccessType) case permissionEnable(PresentationTheme, String) case messageHeader(PresentationTheme, String) @@ -218,8 +218,8 @@ private enum NotificationsAndSoundsEntry: ItemListNodeEntry { static func ==(lhs: NotificationsAndSoundsEntry, rhs: NotificationsAndSoundsEntry) -> Bool { switch lhs { - case let .permissionInfo(lhsTheme, lhsStrings): - if case let .permissionInfo(rhsTheme, rhsStrings) = rhs, lhsTheme === rhsTheme, lhsStrings === rhsStrings { + case let .permissionInfo(lhsTheme, lhsStrings, lhsAccessType): + if case let .permissionInfo(rhsTheme, rhsStrings, rhsAccessType) = rhs, lhsTheme === rhsTheme, lhsStrings === rhsStrings, lhsAccessType == rhsAccessType { return true } else { return false @@ -431,8 +431,8 @@ private enum NotificationsAndSoundsEntry: ItemListNodeEntry { func item(_ arguments: NotificationsAndSoundsArguments) -> ListViewItem { switch self { - case let .permissionInfo(theme, strings): - return PermissionInfoItemListItem(theme: theme, strings: strings, subject: .notifications, sectionId: self.section) + case let .permissionInfo(theme, strings, type): + return PermissionInfoItemListItem(theme: theme, strings: strings, subject: .notifications, type: type, sectionId: self.section) case let .permissionEnable(theme, text): return ItemListActionItem(theme: theme, title: text, kind: .generic, alignment: .natural, sectionId: self.section, style: .blocks, action: { arguments.authorizeNotifications() @@ -573,12 +573,12 @@ private func notificationsAndSoundsEntries(authorizationStatus: AccessType, glob var entries: [NotificationsAndSoundsEntry] = [] switch authorizationStatus { - case .denied: - entries.append(.permissionInfo(presentationData.theme, presentationData.strings)) - entries.append(.permissionEnable(presentationData.theme, presentationData.strings.Permissions_NotificationsAllowInSettings)) + case .denied, .unreachable: + entries.append(.permissionInfo(presentationData.theme, presentationData.strings, authorizationStatus)) + entries.append(.permissionEnable(presentationData.theme, presentationData.strings.Permissions_NotificationsAllowInSettings_v0)) case .notDetermined: - entries.append(.permissionInfo(presentationData.theme, presentationData.strings)) - entries.append(.permissionEnable(presentationData.theme, presentationData.strings.Permissions_NotificationsAllow)) + entries.append(.permissionInfo(presentationData.theme, presentationData.strings, authorizationStatus)) + entries.append(.permissionEnable(presentationData.theme, presentationData.strings.Permissions_NotificationsAllow_v0)) default: break } @@ -659,8 +659,7 @@ public func notificationsAndSoundsController(account: Account, exceptionsList: N switch status { case .notDetermined: DeviceAccess.authorizeAccess(to: .notifications) - account.telegramApplicationContext.applicationBindings.registerForNotifications() - case .denied, .restricted: + case .denied, .restricted, .unreachable: account.telegramApplicationContext.applicationBindings.openSettings() default: break diff --git a/TelegramUI/OpenChatMessage.swift b/TelegramUI/OpenChatMessage.swift index 7d4dc4431e..e7039a372a 100644 --- a/TelegramUI/OpenChatMessage.swift +++ b/TelegramUI/OpenChatMessage.swift @@ -29,7 +29,7 @@ private func chatMessageGalleryControllerData(account: Account, message: Message switch action.action { case let .photoUpdated(image): if let peer = messageMainPeer(message), let image = image { - let promise: Promise<[AvatarGalleryEntry]> = Promise([AvatarGalleryEntry.image(image, peer, message.timestamp, nil)]) + let promise: Promise<[AvatarGalleryEntry]> = Promise([AvatarGalleryEntry.image(image.reference, image.representations.map({ ImageRepresentationWithReference(representation: $0, reference: .media(media: .message(message: MessageReference(message), media: media), resource: $0.resource)) }), peer, message.timestamp, nil)]) let galleryController = AvatarGalleryController(account: account, peer: peer, remoteEntries: promise, replaceRootController: { controller, ready in }) diff --git a/TelegramUI/OpenInAppIconResources.swift b/TelegramUI/OpenInAppIconResources.swift index a68b3ca4ef..45113d5cb7 100644 --- a/TelegramUI/OpenInAppIconResources.swift +++ b/TelegramUI/OpenInAppIconResources.swift @@ -42,7 +42,7 @@ public class OpenInAppIconResource: TelegramMediaResource { return OpenInAppIconResourceId(appStoreId: self.appStoreId) } - public func isEqual(to: TelegramMediaResource) -> Bool { + public func isEqual(to: MediaResource) -> Bool { if let to = to as? OpenInAppIconResource { return self.appStoreId == to.appStoreId } else { diff --git a/TelegramUI/OpenResolvedUrl.swift b/TelegramUI/OpenResolvedUrl.swift index 1621c33e45..5430fd1192 100644 --- a/TelegramUI/OpenResolvedUrl.swift +++ b/TelegramUI/OpenResolvedUrl.swift @@ -20,7 +20,7 @@ private func defaultNavigationForPeerId(_ peerId: PeerId?, navigation: ChatContr } } -func openResolvedUrl(_ resolvedUrl: ResolvedUrl, account: Account, context: OpenURLContext = .generic, navigationController: NavigationController?, openPeer: @escaping (PeerId, ChatControllerInteractionNavigateToPeer) -> Void, sendFile: ((FileMediaReference) -> Void)? = nil, present: (ViewController, Any?) -> Void, dismissInput: @escaping () -> Void) { +func openResolvedUrl(_ resolvedUrl: ResolvedUrl, account: Account, context: OpenURLContext = .generic, navigationController: NavigationController?, openPeer: @escaping (PeerId, ChatControllerInteractionNavigateToPeer) -> Void, sendFile: ((FileMediaReference) -> Void)? = nil, present: @escaping (ViewController, Any?) -> Void, dismissInput: @escaping () -> Void) { let presentationData = account.telegramApplicationContext.currentPresentationData.with { $0 } switch resolvedUrl { case let .externalUrl(url): @@ -106,5 +106,62 @@ func openResolvedUrl(_ resolvedUrl: ResolvedUrl, account: Account, context: Open present(standardTextAlertController(theme: AlertControllerTheme(presentationTheme: presentationData.theme), title: nil, text: presentationData.strings.AuthCode_Alert(formattedConfirmationCode(code)).0, actions: [TextAlertAction(type: .defaultAction, title: presentationData.strings.Common_OK, action: {})]), nil) } } + case let .cancelAccountReset(phone, hash): + let presentationData = account.telegramApplicationContext.currentPresentationData.with { $0 } + let controller = OverlayStatusController(theme: presentationData.theme, strings: presentationData.strings, type: .loading(cancelled: nil)) + present(controller, nil) + let _ = (requestCancelAccountResetData(network: account.network, hash: hash) + |> deliverOnMainQueue).start(next: { [weak controller] data in + controller?.dismiss() + present(confirmPhoneNumberCodeController(account: account, phoneNumber: phone, codeData: data), ViewControllerPresentationArguments(presentationAnimation: .modalSheet)) + }, error: { [weak controller] error in + controller?.dismiss() + + let text: String + switch error { + case .limitExceeded: + text = presentationData.strings.Login_CodeFloodError + case .generic: + text = presentationData.strings.Login_UnknownError + } + let presentationData = account.telegramApplicationContext.currentPresentationData.with { $0 } + present(standardTextAlertController(theme: AlertControllerTheme(presentationTheme: presentationData.theme), title: nil, text: text, actions: [TextAlertAction(type: .defaultAction, title: presentationData.strings.Common_OK, action: {})]), nil) + }) + dismissInput() + case let .share(url, text): + let controller = PeerSelectionController(account: account) + controller.peerSelected = { [weak controller] peerId in + if let strongController = controller { + strongController.dismiss() + + let textInputState: ChatTextInputState + if let text = text, !text.isEmpty { + let urlString = NSMutableAttributedString(string: "\(text)\n") + let textString = NSAttributedString(string: "\(text)") + let selectionRange: Range = urlString.length ..< (urlString.length + textString.length) + urlString.append(textString) + textInputState = ChatTextInputState(inputText: urlString, selectionRange: selectionRange) + } else { + textInputState = ChatTextInputState(inputText: NSAttributedString(string: "\(url)")) + } + + let _ = (account.postbox.transaction({ transaction -> Void in + transaction.updatePeerChatInterfaceState(peerId, update: { currentState in + if let currentState = currentState as? ChatInterfaceState { + return currentState.withUpdatedComposeInputState(textInputState) + } else { + return ChatInterfaceState().withUpdatedComposeInputState(textInputState) + } + }) + }) + |> deliverOnMainQueue).start(completed: { + navigationController?.pushViewController(ChatController(account: account, chatLocation: .peer(peerId), messageId: nil)) + }) + } + } + if let navigationController = navigationController { + account.telegramApplicationContext.applicationBindings.dismissNativeController() + (navigationController.viewControllers.last as? ViewController)?.present(controller, in: .window(.root), with: ViewControllerPresentationArguments(presentationAnimation: ViewControllerPresentationAnimation.modalSheet)) + } } } diff --git a/TelegramUI/OpenUrl.swift b/TelegramUI/OpenUrl.swift index 9f1971236f..4c6259b5ce 100644 --- a/TelegramUI/OpenUrl.swift +++ b/TelegramUI/OpenUrl.swift @@ -187,10 +187,10 @@ public func openExternalUrl(account: Account, context: OpenURLContext = .generic navigationController?.pushViewController(infoController) } }) - case .chat: + case let .chat(_, messageId): if let navigationController = navigationController { navigationController.view.window?.rootViewController?.dismiss(animated: true, completion: nil) - navigateToChatController(navigationController: navigationController, account: account, chatLocation: .peer(peerId)) + navigateToChatController(navigationController: navigationController, account: account, chatLocation: .peer(peerId), messageId: messageId) } case let .withBotStartPayload(payload): if let navigationController = navigationController { @@ -296,40 +296,11 @@ public func openExternalUrl(account: Account, context: OpenURLContext = .generic } } if let shareUrl = shareUrl { - let controller = PeerSelectionController(account: account) - controller.peerSelected = { [weak controller] peerId in - if let strongController = controller { - strongController.dismiss() - - let textInputState: ChatTextInputState - if let shareText = shareText, !shareText.isEmpty { - let urlString = NSMutableAttributedString(string: "\(shareUrl)\n") - let textString = NSAttributedString(string: "\(shareText)") - let selectionRange: Range = urlString.length ..< (urlString.length + textString.length) - urlString.append(textString) - textInputState = ChatTextInputState(inputText: urlString, selectionRange: selectionRange) - } else { - textInputState = ChatTextInputState(inputText: NSAttributedString(string: "\(shareUrl)")) - } - - let _ = (account.postbox.transaction({ transaction -> Void in - transaction.updatePeerChatInterfaceState(peerId, update: { currentState in - if let currentState = currentState as? ChatInterfaceState { - return currentState.withUpdatedComposeInputState(textInputState) - } else { - return ChatInterfaceState().withUpdatedComposeInputState(textInputState) - } - }) - }) - |> deliverOnMainQueue).start(completed: { - navigationController?.pushViewController(ChatController(account: account, chatLocation: .peer(peerId), messageId: nil)) - }) - } - } - if let navigationController = navigationController { - account.telegramApplicationContext.applicationBindings.dismissNativeController() - (navigationController.viewControllers.last as? ViewController)?.present(controller, in: .window(.root), with: ViewControllerPresentationArguments(presentationAnimation: ViewControllerPresentationAnimation.modalSheet)) + var resultUrl = "https://t.me/share/url?url=\(urlEncodedStringFromString(shareUrl))" + if let shareText = shareText { + resultUrl += "&text=\(urlEncodedStringFromString(shareText))" } + convertedUrl = resultUrl } } } else if parsedUrl.host == "socks" || parsedUrl.host == "proxy" { @@ -483,6 +454,25 @@ public func openExternalUrl(account: Account, context: OpenURLContext = .generic convertedUrl = "https://t.me/login/\(code)" } } + } else if parsedUrl.host == "confirmphone" { + if let components = URLComponents(string: "/?" + query) { + var phone: String? + var hash: String? + if let queryItems = components.queryItems { + for queryItem in queryItems { + if let value = queryItem.value { + if queryItem.name == "phone" { + phone = value + } else if queryItem.name == "hash" { + hash = value + } + } + } + } + if let phone = phone, let hash = hash { + convertedUrl = "https://t.me/confirmphone?phone=\(phone)&hash=\(hash)" + } + } } if parsedUrl.host == "resolve" { diff --git a/TelegramUI/PeerAvatarImageGalleryItem.swift b/TelegramUI/PeerAvatarImageGalleryItem.swift index 8f0b473e5f..320363fb45 100644 --- a/TelegramUI/PeerAvatarImageGalleryItem.swift +++ b/TelegramUI/PeerAvatarImageGalleryItem.swift @@ -5,39 +5,20 @@ import SwiftSignalKit import Postbox import TelegramCore -private enum PeerAvatarImageGalleryThumbnailContent: Equatable { - case avatar(PeerReference, [TelegramMediaImageRepresentation]) - case standaloneImage([TelegramMediaImageRepresentation]) - - var representations: [TelegramMediaImageRepresentation] { - switch self { - case let .avatar(_, representations): - return representations - case let .standaloneImage(representations): - return representations - } - } -} - private struct PeerAvatarImageGalleryThumbnailItem: GalleryThumbnailItem { let account: Account let peer: Peer - let content: PeerAvatarImageGalleryThumbnailContent + let content: [ImageRepresentationWithReference] - init(account: Account, peer: Peer, content: PeerAvatarImageGalleryThumbnailContent) { + init(account: Account, peer: Peer, content: [ImageRepresentationWithReference]) { self.account = account self.peer = peer self.content = content } var image: (Signal<(TransformImageArguments) -> DrawingContext?, NoError>, CGSize) { - if let representation = largestImageRepresentation(self.content.representations) { - switch self.content { - case let .avatar(peer, representations): - return (avatarGalleryThumbnailPhoto(account: self.account, representations: representations.map({ ($0, .avatar(peer: peer, resource: $0.resource)) })), representation.dimensions) - case let .standaloneImage(representations): - return (avatarGalleryThumbnailPhoto(account: self.account, representations: representations.map({ ($0, .standalone(resource: $0.resource)) })), representation.dimensions) - } + if let representation = largestImageRepresentation(self.content.map({ $0.representation })) { + return (avatarGalleryThumbnailPhoto(account: self.account, representations: self.content), representation.dimensions) } else { return (.single({ _ in return nil }), CGSize(width: 128.0, height: 128.0)) } @@ -92,16 +73,12 @@ class PeerAvatarImageGalleryItem: GalleryItem { } func thumbnailItem() -> (Int64, GalleryThumbnailItem)? { - let content: PeerAvatarImageGalleryThumbnailContent + let content: [ImageRepresentationWithReference] switch self.entry { case let .topImage(representations, _): - if let peerReference = PeerReference(self.peer) { - content = .avatar(peerReference, representations) - } else { - return nil - } - case let .image(image, _, _, _): - content = .standaloneImage(image.representations) + content = representations + case let .image(_, representations, _, _, _): + content = representations } return (0, PeerAvatarImageGalleryThumbnailItem(account: self.account, peer: self.peer, content: content)) @@ -182,73 +159,65 @@ final class PeerAvatarImageGalleryItemNode: ZoomableContentGalleryItemNode { self.footerContentNode.setEntry(entry) - if let largestSize = largestImageRepresentation(entry.representations) { + if let largestSize = largestImageRepresentation(entry.representations.map({ $0.representation })) { let displaySize = largestSize.dimensions.fitted(CGSize(width: 1280.0, height: 1280.0)).dividedByScreenScale().integralFloor self.imageNode.asyncLayout()(TransformImageArguments(corners: ImageCorners(), imageSize: displaySize, boundingSize: displaySize, intrinsicInsets: UIEdgeInsets()))() - let representations: [(TelegramMediaImageRepresentation, MediaResourceReference)] + let representations: [ImageRepresentationWithReference] switch entry { case let .topImage(topRepresentations, _): - if let peerReference = PeerReference(self.peer) { - representations = topRepresentations.map { representation in - return (representation, .avatar(peer: peerReference, resource: representation.resource)) - } - } else { - representations = [] - } - case let .image(image, _, _, _): - representations = image.representations.map { representation in - return (representation, .standalone(resource: representation.resource)) - } + representations = topRepresentations + case let .image(_, imageRepresentations, _, _, _): + representations = imageRepresentations } self.imageNode.setSignal(chatAvatarGalleryPhoto(account: account, representations: representations), dispatchOnDisplayLink: false) self.zoomableContent = (largestSize.dimensions, self.imageNode) - if let largestIndex = representations.index(where: { $0.0 == largestSize }) { - self.fetchDisposable.set(fetchedMediaResource(postbox: self.account.postbox, reference: representations[largestIndex].1).start()) + if let largestIndex = representations.index(where: { $0.representation == largestSize }) { + self.fetchDisposable.set(fetchedMediaResource(postbox: self.account.postbox, reference: representations[largestIndex].reference).start()) } self.statusDisposable.set((account.postbox.mediaBox.resourceStatus(largestSize.resource) - |> deliverOnMainQueue).start(next: { [weak self] status in - if let strongSelf = self { - let previousStatus = strongSelf.status - strongSelf.status = status - switch status { - case .Remote: - strongSelf.statusNode.isHidden = false - strongSelf.statusNodeContainer.isUserInteractionEnabled = true - strongSelf.statusNode.transitionToState(.download(.white), completion: {}) - case let .Fetching(isActive, progress): - strongSelf.statusNode.isHidden = false - strongSelf.statusNodeContainer.isUserInteractionEnabled = true - var actualProgress = progress - if isActive { - actualProgress = max(actualProgress, 0.027) - } - strongSelf.statusNode.transitionToState(.progress(color: .white, lineWidth: nil, value: CGFloat(actualProgress), cancelEnabled: true), completion: {}) - case .Local: - if let previousStatus = previousStatus, case .Fetching = previousStatus { - strongSelf.statusNode.transitionToState(.progress(color: .white, lineWidth: nil, value: 1.0, cancelEnabled: true), completion: { - if let strongSelf = self { - strongSelf.statusNode.alpha = 0.0 - strongSelf.statusNodeContainer.isUserInteractionEnabled = false - strongSelf.statusNode.layer.animateAlpha(from: 1.0, to: 0.0, duration: 0.2, completion: { _ in - if let strongSelf = self { - strongSelf.statusNode.transitionToState(.none, animated: false, completion: {}) - } - }) - } - }) - } else if !strongSelf.statusNode.isHidden && !strongSelf.statusNode.alpha.isZero { - strongSelf.statusNode.alpha = 0.0 - strongSelf.statusNodeContainer.isUserInteractionEnabled = false - strongSelf.statusNode.layer.animateAlpha(from: 1.0, to: 0.0, duration: 0.2, completion: { _ in - if let strongSelf = self { - strongSelf.statusNode.transitionToState(.none, animated: false, completion: {}) - } - }) - } - } + |> deliverOnMainQueue).start(next: { [weak self] status in + if let strongSelf = self { + let previousStatus = strongSelf.status + strongSelf.status = status + switch status { + case .Remote: + strongSelf.statusNode.isHidden = false + strongSelf.statusNodeContainer.isUserInteractionEnabled = true + strongSelf.statusNode.transitionToState(.download(.white), completion: {}) + case let .Fetching(isActive, progress): + strongSelf.statusNode.isHidden = false + strongSelf.statusNodeContainer.isUserInteractionEnabled = true + var actualProgress = progress + if isActive { + actualProgress = max(actualProgress, 0.027) + } + strongSelf.statusNode.transitionToState(.progress(color: .white, lineWidth: nil, value: CGFloat(actualProgress), cancelEnabled: true), completion: {}) + case .Local: + if let previousStatus = previousStatus, case .Fetching = previousStatus { + strongSelf.statusNode.transitionToState(.progress(color: .white, lineWidth: nil, value: 1.0, cancelEnabled: true), completion: { + if let strongSelf = self { + strongSelf.statusNode.alpha = 0.0 + strongSelf.statusNodeContainer.isUserInteractionEnabled = false + strongSelf.statusNode.layer.animateAlpha(from: 1.0, to: 0.0, duration: 0.2, completion: { _ in + if let strongSelf = self { + strongSelf.statusNode.transitionToState(.none, animated: false, completion: {}) + } + }) + } + }) + } else if !strongSelf.statusNode.isHidden && !strongSelf.statusNode.alpha.isZero { + strongSelf.statusNode.alpha = 0.0 + strongSelf.statusNodeContainer.isUserInteractionEnabled = false + strongSelf.statusNode.layer.animateAlpha(from: 1.0, to: 0.0, duration: 0.2, completion: { _ in + if let strongSelf = self { + strongSelf.statusNode.transitionToState(.none, animated: false, completion: {}) + } + }) + } } - })) + } + })) } else { self._ready.set(.single(Void())) } @@ -359,29 +328,21 @@ final class PeerAvatarImageGalleryItemNode: ZoomableContentGalleryItemNode { } @objc func statusPressed() { - if let entry = self.entry, let largestSize = largestImageRepresentation(entry.representations), let status = self.status { + if let entry = self.entry, let largestSize = largestImageRepresentation(entry.representations.map({ $0.representation })), let status = self.status { switch status { case .Fetching: self.account.postbox.mediaBox.cancelInteractiveResourceFetch(largestSize.resource) case .Remote: - let representations: [(TelegramMediaImageRepresentation, MediaResourceReference)] + let representations: [ImageRepresentationWithReference] switch entry { case let .topImage(topRepresentations, _): - if let peerReference = PeerReference(self.peer) { - representations = topRepresentations.map { representation in - return (representation, .avatar(peer: peerReference, resource: representation.resource)) - } - } else { - representations = [] - } - case let .image(image, _, _, _): - representations = image.representations.map { representation in - return (representation, .standalone(resource: representation.resource)) - } + representations = topRepresentations + case let .image(_, imageRepresentations, _, _, _): + representations = imageRepresentations } - if let largestIndex = representations.index(where: { $0.0 == largestSize }) { - self.fetchDisposable.set(fetchedMediaResource(postbox: self.account.postbox, reference: representations[largestIndex].1).start()) + if let largestIndex = representations.index(where: { $0.representation == largestSize }) { + self.fetchDisposable.set(fetchedMediaResource(postbox: self.account.postbox, reference: representations[largestIndex].reference).start()) } default: break diff --git a/TelegramUI/PeerMediaCollectionController.swift b/TelegramUI/PeerMediaCollectionController.swift index 9cfb3df951..a49c844348 100644 --- a/TelegramUI/PeerMediaCollectionController.swift +++ b/TelegramUI/PeerMediaCollectionController.swift @@ -371,6 +371,7 @@ public class PeerMediaCollectionController: TelegramController { } }, updateTextInputStateAndMode: { _ in }, updateInputModeAndDismissedButtonKeyboardMessageId: { _ in + }, openStickers: { }, editMessage: { }, beginMessageSearch: { _, _ in }, dismissMessageSearch: { diff --git a/TelegramUI/PeerMessagesMediaPlaylist.swift b/TelegramUI/PeerMessagesMediaPlaylist.swift index 3a9639e3b0..2e640d4704 100644 --- a/TelegramUI/PeerMessagesMediaPlaylist.swift +++ b/TelegramUI/PeerMessagesMediaPlaylist.swift @@ -360,11 +360,15 @@ final class PeerMessagesMediaPlaylist: SharedMediaPlaylist { return self.messagesLocation } + var currentItemDisappeared: (() -> Void)? + private let navigationDisposable = MetaDisposable() private var playbackStack = PlaybackStack() private var currentItem: (current: Message, around: [Message])? + private var currentlyObservedMessageId: MessageId? + private let currentlyObservedMessageDisposable = MetaDisposable() private var loadingItem: Bool = false private var playedToEnd: Bool = false private var order: MusicPlaybackSettingsOrder = .regular @@ -400,6 +404,7 @@ final class PeerMessagesMediaPlaylist: SharedMediaPlaylist { deinit { self.navigationDisposable.dispose() + self.currentlyObservedMessageDisposable.dispose() } func control(_ action: SharedMediaPlaylistControlAction) { @@ -481,6 +486,27 @@ final class PeerMessagesMediaPlaylist: SharedMediaPlaylist { } } self.stateValue.set(.single(SharedMediaPlaylistState(loading: self.loadingItem, playedToEnd: self.playedToEnd, item: item, nextItem: nextItem, previousItem: previousItem, order: self.order, looping: self.looping))) + if item?.message.id != self.currentlyObservedMessageId { + self.currentlyObservedMessageId = item?.message.id + if let id = item?.message.id { + let key: PostboxViewKey = .messages(Set([id])) + self.currentlyObservedMessageDisposable.set((self.postbox.combinedView(keys: [key]) + |> filter { views in + if let view = views.views[key] as? MessagesView { + if !view.messages.isEmpty { + return false + } + } + return true + } + |> take(1) + |> deliverOnMainQueue).start(next: { [weak self] _ in + self?.currentItemDisappeared?() + })) + } else { + self.currentlyObservedMessageDisposable.set(nil) + } + } } private func loadItem(anchor: PeerMessagesMediaPlaylistLoadAnchor, navigation: PeerMessagesMediaPlaylistNavigation) { diff --git a/TelegramUI/Permission.swift b/TelegramUI/Permission.swift new file mode 100644 index 0000000000..8b5f0e7861 --- /dev/null +++ b/TelegramUI/Permission.swift @@ -0,0 +1,71 @@ +import Foundation +import SwiftSignalKit +import Postbox +import TelegramCore + +public enum PermissionKind: Int32 { + case contacts + case notifications + case siri + case cellularData +} + +public enum PermissionRequestStatus { + case requestable + case denied + case unreachable + case allowed + + init(accessType: AccessType) { + switch accessType { + case .notDetermined: + self = .requestable + case .denied, .restricted: + self = .denied + case .unreachable: + self = .unreachable + case .allowed: + self = .allowed + } + } +} + +public enum PermissionState: Equatable { + case contacts(status: PermissionRequestStatus) + case notifications(status: PermissionRequestStatus) + case siri(status: PermissionRequestStatus) + case cellularData + + var kind: PermissionKind { + switch self { + case .contacts: + return .contacts + case .notifications: + return .notifications + case .siri: + return .siri + case .cellularData: + return .cellularData + } + } + + public var status: PermissionRequestStatus { + switch self { + case let .contacts(status): + return status + case let .notifications(status): + return status + case let .siri(status): + return status + case .cellularData: + return .unreachable + } + } +} + +public func requiredPermissions(account: Account) -> Signal<(PermissionState, PermissionState), NoError> { + return combineLatest(DeviceAccess.authorizationStatus(account: account, subject: .contacts), DeviceAccess.authorizationStatus(account: account, subject: .notifications)) + |> map { contactsStatus, notificationsStatus in + return (.contacts(status: PermissionRequestStatus(accessType: contactsStatus)), .notifications(status: PermissionRequestStatus(accessType: notificationsStatus))) + } +} diff --git a/TelegramUI/PermissionContentNode.swift b/TelegramUI/PermissionContentNode.swift index 461f906130..5197cf5eba 100644 --- a/TelegramUI/PermissionContentNode.swift +++ b/TelegramUI/PermissionContentNode.swift @@ -4,7 +4,7 @@ import AsyncDisplayKit final class PermissionContentNode: ASDisplayNode { private var theme: PresentationTheme - let kind: PermissionStateKind + let kind: PermissionKind private let iconNode: ASImageNode private let titleNode: ImmediateTextNode @@ -17,7 +17,7 @@ final class PermissionContentNode: ASDisplayNode { var buttonAction: (() -> Void)? var openPrivacyPolicy: (() -> Void)? - init(theme: PresentationTheme, strings: PresentationStrings, kind: PermissionStateKind, icon: UIImage?, title: String, text: String, buttonTitle: String, buttonAction: @escaping () -> Void, openPrivacyPolicy: (() -> Void)?) { + init(theme: PresentationTheme, strings: PresentationStrings, kind: PermissionKind, icon: UIImage?, title: String, text: String, buttonTitle: String, buttonAction: @escaping () -> Void, openPrivacyPolicy: (() -> Void)?) { self.theme = theme self.kind = kind @@ -57,7 +57,7 @@ final class PermissionContentNode: ASDisplayNode { self.textNode.attributedText = parseMarkdownIntoAttributedString(text.replacingOccurrences(of: "]", with: "]()"), attributes: MarkdownAttributes(body: body, bold: body, link: link, linkAttribute: { _ in nil }), textAlignment: .center) self.actionButton.title = buttonTitle - self.privacyPolicyButton.isHidden = openPrivacyPolicy != nil + self.privacyPolicyButton.isHidden = openPrivacyPolicy == nil self.addSubnode(self.iconNode) self.addSubnode(self.titleNode) @@ -92,9 +92,11 @@ final class PermissionContentNode: ASDisplayNode { let titleSize = self.titleNode.updateLayout(CGSize(width: size.width - sidePadding * 2.0, height: .greatestFiniteMagnitude)) let textSize = self.textNode.updateLayout(CGSize(width: size.width - sidePadding * 2.0, height: .greatestFiniteMagnitude)) let buttonHeight = self.actionButton.updateLayout(width: size.width, transition: transition) + let privacyButtonSize = self.privacyPolicyButton.measure(CGSize(width: size.width - sidePadding * 2.0, height: .greatestFiniteMagnitude)) let titleSubtitleSpacing: CGFloat = 26.0 let buttonSpacing: CGFloat = 36.0 + let privacySpacing: CGFloat = 45.0 var contentHeight = titleSize.height + titleSubtitleSpacing + textSize.height + buttonHeight + buttonSpacing var imageSize = CGSize() @@ -110,10 +112,13 @@ final class PermissionContentNode: ASDisplayNode { let titleFrame = CGRect(origin: CGPoint(x: floor((size.width - titleSize.width) / 2.0), y: iconFrame.maxY + imageSpacing), size: titleSize) let textFrame = CGRect(origin: CGPoint(x: floor((size.width - textSize.width) / 2.0), y: titleFrame.maxY + titleSubtitleSpacing), size: textSize) let buttonFrame = CGRect(origin: CGPoint(x: 0.0, y: textFrame.maxY + buttonSpacing), size: CGSize(width: size.width, height: buttonHeight)) + let privacyButtonFrame = CGRect(origin: CGPoint(x: floor((size.width - privacyButtonSize.width) / 2.0), y: buttonFrame.maxY + privacySpacing), size: privacyButtonSize) + transition.updateFrame(node: self.iconNode, frame: iconFrame) transition.updateFrame(node: self.titleNode, frame: titleFrame) transition.updateFrame(node: self.textNode, frame: textFrame) transition.updateFrame(node: self.actionButton, frame: buttonFrame) + transition.updateFrame(node: self.privacyPolicyButton, frame: privacyButtonFrame) } } diff --git a/TelegramUI/PermissionController.swift b/TelegramUI/PermissionController.swift index 526d4e70c9..9e55f0dfb9 100644 --- a/TelegramUI/PermissionController.swift +++ b/TelegramUI/PermissionController.swift @@ -4,8 +4,10 @@ import AsyncDisplayKit import SwiftSignalKit import TelegramCore -final class PermissionController : ViewController { +public final class PermissionController : ViewController { private let account: Account + private let splitTest: PermissionUISplitTest + private var state: PermissionState? private var controllerNode: PermissionControllerNode { return self.displayNode as! PermissionControllerNode @@ -21,15 +23,20 @@ final class PermissionController : ViewController { private var presentationData: PresentationData private var presentationDataDisposable: Disposable? - init(account: Account) { + private var allow: (() -> Void)? + private var skip: (() -> Void)? + public var proceed: (() -> Void)? + + public init(account: Account, splitTest: PermissionUISplitTest) { self.account = account + self.splitTest = splitTest self.presentationData = account.telegramApplicationContext.currentPresentationData.with { $0 } super.init(navigationBarPresentationData: NavigationBarPresentationData(theme: NavigationBarTheme(buttonColor: self.presentationData.theme.rootController.navigationBar.accentTextColor, disabledButtonColor: self.presentationData.theme.rootController.navigationBar.disabledButtonColor, primaryTextColor: self.presentationData.theme.rootController.navigationBar.primaryTextColor, backgroundColor: .clear, separatorColor: .clear, badgeBackgroundColor: .clear, badgeStrokeColor: .clear, badgeTextColor: .clear), strings: NavigationBarStrings(presentationStrings: self.presentationData.strings))) self.supportedOrientations = ViewControllerSupportedOrientations(regularSize: .all, compactSize: .portrait) - self.statusBar.statusBarStyle = self.presentationData.theme.rootController.statusBar.style.style + self.updateThemeAndStrings() self.presentationDataDisposable = (account.telegramApplicationContext.presentationData |> deliverOnMainQueue).start(next: { [weak self] presentationData in @@ -54,7 +61,7 @@ final class PermissionController : ViewController { self.presentationDataDisposable?.dispose() } - override func viewDidAppear(_ animated: Bool) { + public override func viewDidAppear(_ animated: Bool) { super.viewDidAppear(animated) if let presentationArguments = self.presentationArguments as? ViewControllerPresentationArguments, !self.didPlayPresentationAnimation { @@ -65,29 +72,99 @@ final class PermissionController : ViewController { } } - override func dismiss(completion: (() -> Void)? = nil) { - self.controllerNode.animateOut(completion: { [weak self] in - self?.presentingViewController?.dismiss(animated: false, completion: nil) - completion?() - }) - self.view.endEditing(true) - } - private func updateThemeAndStrings() { self.statusBar.statusBarStyle = self.presentationData.theme.rootController.statusBar.style.style - self.navigationBar?.updatePresentationData(NavigationBarPresentationData(presentationData: self.presentationData)) - self.title = self.presentationData.strings.Settings_AppLanguage + self.navigationBar?.updatePresentationData(NavigationBarPresentationData(theme: NavigationBarTheme(buttonColor: self.presentationData.theme.rootController.navigationBar.accentTextColor, disabledButtonColor: self.presentationData.theme.rootController.navigationBar.disabledButtonColor, primaryTextColor: self.presentationData.theme.rootController.navigationBar.primaryTextColor, backgroundColor: .clear, separatorColor: .clear, badgeBackgroundColor: .clear, badgeStrokeColor: .clear, badgeTextColor: .clear), strings: NavigationBarStrings(presentationStrings: self.presentationData.strings))) self.navigationItem.backBarButtonItem = UIBarButtonItem(title: nil, style: .plain, target: nil, action: nil) - //self.navigationItem.rightBarButtonItem = UIBarButtonItem(title: self.presentationData.strings.Permissions_Skip, style: .plain, target: self, action: #selector(PermissionController.nextPressed)) + self.navigationItem.rightBarButtonItem = UIBarButtonItem(title: self.presentationData.strings.Permissions_Skip, style: .plain, target: self, action: #selector(PermissionController.nextPressed)) self.controllerNode.updatePresentationData(self.presentationData) } - override func loadDisplayNode() { - self.displayNode = PermissionControllerNode(account: self.account) + private func openAppSettings() { + self.account.telegramApplicationContext.applicationBindings.openSettings() + } + + public func setState(_ state: PermissionState, animated: Bool) { + guard state != self.state else { + return + } + + self.state = state + switch state { + case let .contacts(status): + self.splitTest.addEvent(.ContactsModalRequest) + + self.allow = { [weak self] in + if let strongSelf = self { + switch status { + case .requestable: + strongSelf.splitTest.addEvent(.ContactsRequest) + DeviceAccess.authorizeAccess(to: .contacts, { [weak self] result in + if let strongSelf = self { + if result { + strongSelf.splitTest.addEvent(.ContactsAllowed) + } else { + strongSelf.splitTest.addEvent(.ContactsDenied) + } + strongSelf.proceed?() + } + }) + case .denied: + strongSelf.openAppSettings() + strongSelf.proceed?() + default: + break + } + } + } + case let .notifications(status): + self.splitTest.addEvent(.NotificationsModalRequest) + + self.allow = { [weak self] in + if let strongSelf = self { + switch status { + case .requestable: + strongSelf.splitTest.addEvent(.NotificationsRequest) + DeviceAccess.authorizeAccess(to: .notifications, { [weak self] result in + if let strongSelf = self { + if result { + strongSelf.splitTest.addEvent(.NotificationsAllowed) + } else { + strongSelf.splitTest.addEvent(.NotificationsDenied) + } + strongSelf.proceed?() + } + }) + case .denied, .unreachable: + strongSelf.openAppSettings() + strongSelf.proceed?() + default: + break + } + } + } + case let .siri(status): + self.allow = { [weak self] in + self?.proceed?() + } + case let .cellularData: + self.allow = { [weak self] in + self?.proceed?() + } + } + + self.skip = { [weak self] in + self?.proceed?() + } + self.controllerNode.setState(state, transition: animated ? .animated(duration: 0.4, curve: .spring) : .immediate) + } + + public override func loadDisplayNode() { + self.displayNode = PermissionControllerNode(account: self.account, splitTest: self.splitTest) self.displayNodeDidLoad() self.controllerNode.allow = { [weak self] in - //self?.allow?() + self?.allow?() } self.controllerNode.openPrivacyPolicy = { [weak self] in if let strongSelf = self { @@ -96,13 +173,20 @@ final class PermissionController : ViewController { } } - override func containerLayoutUpdated(_ layout: ContainerViewLayout, transition: ContainedViewLayoutTransition) { + public override func containerLayoutUpdated(_ layout: ContainerViewLayout, transition: ContainedViewLayoutTransition) { super.containerLayoutUpdated(layout, transition: transition) self.controllerNode.containerLayoutUpdated(layout, navigationBarHeight: self.navigationHeight, transition: transition) } @objc private func nextPressed() { - //self.controllerNode.activateNextAction() + self.skip?() + } + + override public func dismiss(completion: (() -> Void)? = nil) { + self.controllerNode.animateOut(completion: { [weak self] in + self?.presentingViewController?.dismiss(animated: false, completion: nil) + completion?() + }) } } diff --git a/TelegramUI/PermissionControllerNode.swift b/TelegramUI/PermissionControllerNode.swift index 88c9ba5e3a..bf1a1e051c 100644 --- a/TelegramUI/PermissionControllerNode.swift +++ b/TelegramUI/PermissionControllerNode.swift @@ -4,44 +4,6 @@ import AsyncDisplayKit import SwiftSignalKit import TelegramCore -enum PermissionStateKind: Int32 { - case contacts - case notifications - case siri - case cellularData -} - -private enum PermissionRequestStatus { - case requestable - case denied -} - -private enum PermissionNotificationsRequestStatus { - case requestable - case denied - case unreachable -} - -private enum PermissionState: Equatable { - case contacts(status: PermissionRequestStatus) - case notifications(status: PermissionNotificationsRequestStatus) - case siri(status: PermissionRequestStatus) - case cellularData - - var kind: PermissionStateKind { - switch self { - case .contacts: - return .contacts - case .notifications: - return .notifications - case .siri: - return .siri - case .cellularData: - return .cellularData - } - } -} - private struct PermissionControllerDataState: Equatable { var state: PermissionState? } @@ -70,9 +32,20 @@ extension PermissionControllerState { } } +private func localizedString(for key: String, strings: PresentationStrings, fallback: String = "") -> String { + if let string = strings.primaryComponent.dict[key] { + return string + } else if let string = strings.secondaryComponent?.dict[key] { + return string + } else { + return fallback + } +} + final class PermissionControllerNode: ASDisplayNode { private let account: Account private var presentationData: PresentationData + private let splitTest: PermissionUISplitTest private var innerState: PermissionControllerInnerState @@ -82,9 +55,10 @@ final class PermissionControllerNode: ASDisplayNode { var openPrivacyPolicy: (() -> Void)? var dismiss: (() -> Void)? - init(account: Account) { + init(account: Account, splitTest: PermissionUISplitTest) { self.account = account self.presentationData = account.telegramApplicationContext.currentPresentationData.with { $0 } + self.splitTest = splitTest self.innerState = PermissionControllerInnerState(layout: nil, data: PermissionControllerDataState(state: nil)) super.init() @@ -103,7 +77,8 @@ final class PermissionControllerNode: ASDisplayNode { } private func applyPresentationData() { - self.backgroundColor = self.presentationData.theme.list.plainBackgroundColor } + self.backgroundColor = self.presentationData.theme.list.plainBackgroundColor + } func animateIn(completion: (() -> Void)? = nil) { self.layer.animatePosition(from: CGPoint(x: self.layer.position.x, y: self.layer.position.y + self.layer.bounds.size.height), to: self.layer.position, duration: 0.5, timingFunction: kCAMediaTimingFunctionSpring) @@ -115,6 +90,12 @@ final class PermissionControllerNode: ASDisplayNode { }) } + public func setState(_ state: PermissionState, transition: ContainedViewLayoutTransition) { + self.updateState({ currentState -> PermissionControllerInnerState in + return PermissionControllerInnerState(layout: currentState.layout, data: PermissionControllerDataState(state: state)) + }, transition: transition) + } + private func updateState(_ f: (PermissionControllerInnerState) -> PermissionControllerInnerState, transition: ContainedViewLayoutTransition) { let updatedState = f(self.innerState) if updatedState != self.innerState { @@ -140,39 +121,59 @@ final class PermissionControllerNode: ASDisplayNode { switch dataState { case let .contacts(status): icon = UIImage(bundleImageName: "Settings/Permissions/Contacts") - title = self.presentationData.strings.Permissions_ContactsTitle - text = self.presentationData.strings.Permissions_ContactsText - if status == .denied { - buttonTitle = self.presentationData.strings.Permissions_ContactsAllowInSettings + if case let .modal(titleKey, textKey, allowTitleKey, allowInSettingsTitleKey) = self.splitTest.configuration.contacts { + title = localizedString(for: titleKey, strings: self.presentationData.strings) + text = localizedString(for: textKey, strings: self.presentationData.strings) + if status == .denied { + buttonTitle = localizedString(for: allowInSettingsTitleKey, strings: self.presentationData.strings) + } else { + buttonTitle = localizedString(for: allowTitleKey, strings: self.presentationData.strings) + } } else { - buttonTitle = self.presentationData.strings.Permissions_ContactsAllow + title = self.presentationData.strings.Permissions_ContactsTitle_v0 + text = self.presentationData.strings.Permissions_ContactsText_v0 + if status == .denied { + buttonTitle = self.presentationData.strings.Permissions_ContactsAllowInSettings_v0 + } else { + buttonTitle = self.presentationData.strings.Permissions_ContactsAllow_v0 + } } hasPrivacyPolicy = true case let .notifications(status): icon = UIImage(bundleImageName: "Settings/Permissions/Notifications") - title = self.presentationData.strings.Permissions_NotificationsTitle - text = self.presentationData.strings.Permissions_NotificationsText - if status == .denied { - buttonTitle = self.presentationData.strings.Permissions_NotificationsAllowInSettings + if case let .modal(titleKey, textKey, allowTitleKey, allowInSettingsTitleKey) = self.splitTest.configuration.notifications { + title = localizedString(for: titleKey, strings: self.presentationData.strings, fallback: self.presentationData.strings.Permissions_NotificationsTitle_v0) + text = localizedString(for: textKey, strings: self.presentationData.strings, fallback: self.presentationData.strings.Permissions_NotificationsText_v0) + if status == .denied { + buttonTitle = localizedString(for: allowInSettingsTitleKey, strings: self.presentationData.strings, fallback: self.presentationData.strings.Permissions_NotificationsAllowInSettings_v0) + } else { + buttonTitle = localizedString(for: allowTitleKey, strings: self.presentationData.strings, fallback: self.presentationData.strings.Permissions_NotificationsAllow_v0) + } } else { - buttonTitle = self.presentationData.strings.Permissions_NotificationsAllow + title = self.presentationData.strings.Permissions_NotificationsTitle_v0 + text = self.presentationData.strings.Permissions_NotificationsText_v0 + if status == .denied { + buttonTitle = self.presentationData.strings.Permissions_NotificationsAllowInSettings_v0 + } else { + buttonTitle = self.presentationData.strings.Permissions_NotificationsAllow_v0 + } } hasPrivacyPolicy = false case let .siri(status): icon = UIImage(bundleImageName: "Settings/Permissions/Siri") - title = self.presentationData.strings.Permissions_SiriTitle - text = self.presentationData.strings.Permissions_SiriText + title = self.presentationData.strings.Permissions_SiriTitle_v0 + text = self.presentationData.strings.Permissions_SiriText_v0 if status == .denied { - buttonTitle = self.presentationData.strings.Permissions_SiriAllowInSettings + buttonTitle = self.presentationData.strings.Permissions_SiriAllowInSettings_v0 } else { - buttonTitle = self.presentationData.strings.Permissions_SiriAllow + buttonTitle = self.presentationData.strings.Permissions_SiriAllow_v0 } hasPrivacyPolicy = false case .cellularData: icon = UIImage(bundleImageName: "Settings/Permissions/CellularData") - title = self.presentationData.strings.Permissions_CellularDataTitle - text = self.presentationData.strings.Permissions_CellularDataText - buttonTitle = self.presentationData.strings.Permissions_CellularDataAllowInSettings + title = self.presentationData.strings.Permissions_CellularDataTitle_v0 + text = self.presentationData.strings.Permissions_CellularDataText_v0 + buttonTitle = self.presentationData.strings.Permissions_CellularDataAllowInSettings_v0 hasPrivacyPolicy = false } diff --git a/TelegramUI/PermissionInfoItem.swift b/TelegramUI/PermissionInfoItem.swift index 704857b216..7101082922 100644 --- a/TelegramUI/PermissionInfoItem.swift +++ b/TelegramUI/PermissionInfoItem.swift @@ -9,14 +9,16 @@ class PermissionInfoItem: ListViewItem { let theme: PresentationTheme let strings: PresentationStrings let subject: DeviceAccessSubject + let type: AccessType - init(theme: PresentationTheme, strings: PresentationStrings, subject: DeviceAccessSubject) { + init(theme: PresentationTheme, strings: PresentationStrings, subject: DeviceAccessSubject, type: AccessType) { self.theme = theme self.strings = strings self.subject = subject + self.type = type } - func nodeConfiguredForParams(async: @escaping (@escaping () -> Void) -> Void, params: ListViewItemLayoutParams, synchronousLoads: Bool, previousItem: ListViewItem?, nextItem: ListViewItem?, completion: @escaping (ListViewItemNode, @escaping () -> (Signal?, () -> Void)) -> Void) { + func nodeConfiguredForParams(async: @escaping (@escaping () -> Void) -> Void, params: ListViewItemLayoutParams, synchronousLoads: Bool, previousItem: ListViewItem?, nextItem: ListViewItem?, completion: @escaping (ListViewItemNode, @escaping () -> (Signal?, (ListViewItemApply) -> Void)) -> Void) { async { let node = PermissionInfoItemNode() let (layout, apply) = node.asyncLayout()(self, params, nil) @@ -26,13 +28,13 @@ class PermissionInfoItem: ListViewItem { Queue.mainQueue().async { completion(node, { - return (nil, { apply() }) + return (nil, { _ in apply() }) }) } } } - func updateNode(async: @escaping (@escaping () -> Void) -> Void, node: @escaping () -> ListViewItemNode, params: ListViewItemLayoutParams, previousItem: ListViewItem?, nextItem: ListViewItem?, animation: ListViewItemUpdateAnimation, completion: @escaping (ListViewItemNodeLayout, @escaping () -> Void) -> Void) { + func updateNode(async: @escaping (@escaping () -> Void) -> Void, node: @escaping () -> ListViewItemNode, params: ListViewItemLayoutParams, previousItem: ListViewItem?, nextItem: ListViewItem?, animation: ListViewItemUpdateAnimation, completion: @escaping (ListViewItemNodeLayout, @escaping (ListViewItemApply) -> Void) -> Void) { Queue.mainQueue().async { if let nodeValue = node() as? PermissionInfoItemNode { let makeLayout = nodeValue.asyncLayout() @@ -40,7 +42,7 @@ class PermissionInfoItem: ListViewItem { async { let (layout, apply) = makeLayout(self, params, nil) Queue.mainQueue().async { - completion(layout, { + completion(layout, { _ in apply() }) } @@ -53,12 +55,12 @@ class PermissionInfoItem: ListViewItem { class PermissionInfoItemListItem: PermissionInfoItem, ItemListItem { let sectionId: ItemListSectionId - init(theme: PresentationTheme, strings: PresentationStrings, subject: DeviceAccessSubject, sectionId: ItemListSectionId) { + init(theme: PresentationTheme, strings: PresentationStrings, subject: DeviceAccessSubject, type: AccessType, sectionId: ItemListSectionId) { self.sectionId = sectionId - super.init(theme: theme, strings: strings, subject: subject) + super.init(theme: theme, strings: strings, subject: subject, type: type) } - override func nodeConfiguredForParams(async: @escaping (@escaping () -> Void) -> Void, params: ListViewItemLayoutParams, synchronousLoads: Bool, previousItem: ListViewItem?, nextItem: ListViewItem?, completion: @escaping (ListViewItemNode, @escaping () -> (Signal?, () -> Void)) -> Void) { + override func nodeConfiguredForParams(async: @escaping (@escaping () -> Void) -> Void, params: ListViewItemLayoutParams, synchronousLoads: Bool, previousItem: ListViewItem?, nextItem: ListViewItem?, completion: @escaping (ListViewItemNode, @escaping () -> (Signal?, (ListViewItemApply) -> Void)) -> Void) { async { let node = PermissionInfoItemNode() let (layout, apply) = node.asyncLayout()(self, params, itemListNeighbors(item: self, topItem: previousItem as? ItemListItem, bottomItem: nextItem as? ItemListItem)) @@ -68,13 +70,13 @@ class PermissionInfoItemListItem: PermissionInfoItem, ItemListItem { Queue.mainQueue().async { completion(node, { - return (nil, { apply() }) + return (nil, { _ in apply() }) }) } } } - override func updateNode(async: @escaping (@escaping () -> Void) -> Void, node: @escaping () -> ListViewItemNode, params: ListViewItemLayoutParams, previousItem: ListViewItem?, nextItem: ListViewItem?, animation: ListViewItemUpdateAnimation, completion: @escaping (ListViewItemNodeLayout, @escaping () -> Void) -> Void) { + override func updateNode(async: @escaping (@escaping () -> Void) -> Void, node: @escaping () -> ListViewItemNode, params: ListViewItemLayoutParams, previousItem: ListViewItem?, nextItem: ListViewItem?, animation: ListViewItemUpdateAnimation, completion: @escaping (ListViewItemNodeLayout, @escaping (ListViewItemApply) -> Void) -> Void) { Queue.mainQueue().async { if let nodeValue = node() as? PermissionInfoItemNode { let makeLayout = nodeValue.asyncLayout() @@ -82,7 +84,7 @@ class PermissionInfoItemListItem: PermissionInfoItem, ItemListItem { async { let (layout, apply) = makeLayout(self, params, itemListNeighbors(item: self, topItem: previousItem as? ItemListItem, bottomItem: nextItem as? ItemListItem)) Queue.mainQueue().async { - completion(layout, { + completion(layout, { _ in apply() }) } @@ -183,7 +185,12 @@ class PermissionInfoItemNode: ListViewItemNode { text = item.strings.Contacts_PermissionsText case .notifications: title = item.strings.Notifications_PermissionsTitle - text = item.strings.Notifications_PermissionsText + switch item.type { + case .unreachable: + text = item.strings.Notifications_PermissionsUnreachableText + default: + text = item.strings.Notifications_PermissionsText + } default: title = "" text = "" diff --git a/TelegramUI/PermissionSplitTest.swift b/TelegramUI/PermissionSplitTest.swift new file mode 100644 index 0000000000..0a7ecb1644 --- /dev/null +++ b/TelegramUI/PermissionSplitTest.swift @@ -0,0 +1,106 @@ +import Foundation +import SwiftSignalKit +import Postbox +import TelegramCore + +extension PermissionKind { + fileprivate static var defaultOrder: [PermissionKind] { + return [.contacts, .notifications] + } +} + +public enum PermissionUIRequestVariation { + case `default` + case modal(title: String, text: String, allowTitle: String, allowInSettingsTitle: String) +} + +public struct PermissionUISplitTest: SplitTest { + public typealias Configuration = PermissionUIConfiguration + public typealias Event = PermissionUIEvent + + public let postbox: Postbox + public let bucket: String? + public let configuration: Configuration + + public init(postbox: Postbox, bucket: String?, configuration: Configuration) { + self.postbox = postbox + self.bucket = bucket + self.configuration = configuration + } + + public struct PermissionUIConfiguration: SplitTestConfiguration { + public static var defaultValue: PermissionUIConfiguration { + return PermissionUIConfiguration(contacts: .default, notifications: .default, order: PermissionKind.defaultOrder) + } + + public let contacts: PermissionUIRequestVariation + public let notifications: PermissionUIRequestVariation + public let order: [PermissionKind] + + fileprivate init(contacts: PermissionUIRequestVariation, notifications: PermissionUIRequestVariation, order: [PermissionKind]) { + self.contacts = contacts + self.notifications = notifications + self.order = order + } + + static func with(appConfiguration: AppConfiguration) -> (PermissionUIConfiguration, String?) { + if let data = appConfiguration.data, let permissions = data["ui_permissions_modals"] as? [String: Any] { + let contacts: PermissionUIRequestVariation + if let modal = permissions["phonebook_modal"] as? [String: Any] { + contacts = .modal(title: modal["popup_title_lang"] as? String ?? "", text: modal["popup_title_lang"] as? String ?? "", allowTitle: modal["popup_title_lang"] as? String ?? "", allowInSettingsTitle: modal["popup_title_lang"] as? String ?? "") + } else { + contacts = .default + } + + let notifications: PermissionUIRequestVariation + if let modal = permissions["notifications_modal"] as? [String: Any] { + notifications = .modal(title: modal["popup_title_lang"] as? String ?? "", text: modal["popup_title_lang"] as? String ?? "", allowTitle: modal["popup_title_lang"] as? String ?? "", allowInSettingsTitle: modal["popup_title_lang"] as? String ?? "") + } else { + notifications = .default + } + + let order: [PermissionKind] + if let values = permissions["order"] as? [String] { + order = values.compactMap { value in + switch value { + case "phonebook": + return .contacts + case "notifications": + return .notifications + default: + return nil + } + } + } else { + order = PermissionKind.defaultOrder + } + + return (PermissionUIConfiguration(contacts: contacts, notifications: notifications, order: order), permissions["bucket"] as? String) + } else { + return (.defaultValue, nil) + } + } + } + + public enum PermissionUIEvent: String, SplitTestEvent { + case ContactsModalRequest = "phbmodal_request" + case ContactsRequest = "phbperm_request" + case ContactsAllowed = "phbperm_allow" + case ContactsDenied = "phbperm_disallow" + case NotificationsModalRequest = "ntfmodal_request" + case NotificationsRequest = "ntfperm_request" + case NotificationsAllowed = "ntfperm_allow" + case NotificationsDenied = "ntfperm_disallow" + } +} + +public func permissionUISplitTest(postbox: Postbox) -> Signal { + return postbox.preferencesView(keys: [PreferencesKeys.appConfiguration]) + |> map { view in + return view.values[PreferencesKeys.appConfiguration] as? AppConfiguration ?? .defaultValue + } + |> map { appConfiguration in + let (config, bucket) = PermissionUISplitTest.Configuration.with(appConfiguration: appConfiguration) + return PermissionUISplitTest(postbox: postbox, bucket: bucket, configuration: config) + } +} diff --git a/TelegramUI/PhotoResources.swift b/TelegramUI/PhotoResources.swift index e531f59dea..dda90d78f3 100644 --- a/TelegramUI/PhotoResources.swift +++ b/TelegramUI/PhotoResources.swift @@ -596,14 +596,14 @@ func rawMessagePhoto(postbox: Postbox, photoReference: ImageMediaReference) -> S } } -public func chatMessagePhoto(postbox: Postbox, photoReference: ImageMediaReference, synchronousLoad: Bool = false) -> Signal<(TransformImageArguments) -> DrawingContext?, NoError> { - return chatMessagePhotoInternal(photoData: chatMessagePhotoDatas(postbox: postbox, photoReference: photoReference, synchronousLoad: synchronousLoad), synchronousLoad: synchronousLoad) +public func chatMessagePhoto(postbox: Postbox, photoReference: ImageMediaReference, synchronousLoad: Bool = false, tinyThumbnailData: TinyThumbnailData? = nil) -> Signal<(TransformImageArguments) -> DrawingContext?, NoError> { + return chatMessagePhotoInternal(photoData: chatMessagePhotoDatas(postbox: postbox, photoReference: photoReference, synchronousLoad: synchronousLoad), synchronousLoad: synchronousLoad, tinyThumbnailData: tinyThumbnailData) |> map { _, generate in return generate } } -public func chatMessagePhotoInternal(photoData: Signal<(Data?, Data?, Bool), NoError>, synchronousLoad: Bool = false) -> Signal<(() -> CGSize?, (TransformImageArguments) -> DrawingContext?), NoError> { +public func chatMessagePhotoInternal(photoData: Signal<(Data?, Data?, Bool), NoError>, synchronousLoad: Bool = false, tinyThumbnailData: TinyThumbnailData? = nil) -> Signal<(() -> CGSize?, (TransformImageArguments) -> DrawingContext?), NoError> { return photoData |> map { (thumbnailData, fullSizeData, fullSizeComplete) in return ({ @@ -650,6 +650,21 @@ public func chatMessagePhotoInternal(photoData: Signal<(Data?, Data?, Bool), NoE thumbnailImage = image } + if GlobalExperimentalSettings.forceTinyThumbnailsPreview { + if let fullSizeImageValue = fullSizeImage { + if let data = compressTinyThumbnail(UIImage(cgImage: fullSizeImageValue)) { + if let result = decompressTinyThumbnail(data: data) { + fullSizeImage = nil + thumbnailImage = result.cgImage + } + } + } + } else if let tinyThumbnailData = tinyThumbnailData { + if let result = decompressTinyThumbnail(data: tinyThumbnailData) { + thumbnailImage = result.cgImage + } + } + var blurredThumbnailImage: UIImage? if let thumbnailImage = thumbnailImage { let thumbnailSize = CGSize(width: thumbnailImage.width, height: thumbnailImage.height) @@ -1110,18 +1125,19 @@ func chatSecretPhoto(account: Account, photoReference: ImageMediaReference) -> S } } -private func avatarGalleryThumbnailDatas(postbox: Postbox, representations: [(TelegramMediaImageRepresentation, MediaResourceReference)], fullRepresentationSize: CGSize = CGSize(width: 1280.0, height: 1280.0), autoFetchFullSize: Bool = false) -> Signal<(Data?, Data?, Bool), NoError> { - if let smallestRepresentation = smallestImageRepresentation(representations.map({ $0.0 })), let largestRepresentation = imageRepresentationLargerThan(representations.map({ $0.0 }), size: fullRepresentationSize), let smallestIndex = representations.index(where: { $0.0 == smallestRepresentation }), let largestIndex = representations.index(where: { $0.0 == largestRepresentation }) { - +private func avatarGalleryThumbnailDatas(postbox: Postbox, representations: [ImageRepresentationWithReference], fullRepresentationSize: CGSize = CGSize(width: 1280.0, height: 1280.0), autoFetchFullSize: Bool = false) -> Signal<(Data?, Data?, Bool), NoError> { + if let smallestRepresentation = smallestImageRepresentation(representations.map({ $0.representation })), let largestRepresentation = imageRepresentationLargerThan(representations.map({ $0.representation }), size: fullRepresentationSize), let smallestIndex = representations.index(where: { $0.representation == smallestRepresentation }), let largestIndex = representations.index(where: { $0.representation == largestRepresentation }) { let maybeFullSize = postbox.mediaBox.resourceData(largestRepresentation.resource) - let signal = maybeFullSize |> take(1) |> mapToSignal { maybeData -> Signal<(Data?, Data?, Bool), NoError> in + let signal = maybeFullSize + |> take(1) + |> mapToSignal { maybeData -> Signal<(Data?, Data?, Bool), NoError> in if maybeData.complete { let loadedData: Data? = try? Data(contentsOf: URL(fileURLWithPath: maybeData.path), options: []) return .single((nil, loadedData, true)) } else { - let fetchedThumbnail = fetchedMediaResource(postbox: postbox, reference: representations[smallestIndex].1, statsCategory: .image) - let fetchedFullSize = fetchedMediaResource(postbox: postbox, reference: representations[largestIndex].1, statsCategory: .image) + let fetchedThumbnail = fetchedMediaResource(postbox: postbox, reference: representations[smallestIndex].reference, statsCategory: .image) + let fetchedFullSize = fetchedMediaResource(postbox: postbox, reference: representations[largestIndex].reference, statsCategory: .image) let thumbnail = Signal { subscriber in let fetchedDisposable = fetchedThumbnail.start() @@ -1177,7 +1193,7 @@ private func avatarGalleryThumbnailDatas(postbox: Postbox, representations: [(Te } } -func avatarGalleryThumbnailPhoto(account: Account, representations: [(TelegramMediaImageRepresentation, MediaResourceReference)]) -> Signal<(TransformImageArguments) -> DrawingContext?, NoError> { +func avatarGalleryThumbnailPhoto(account: Account, representations: [ImageRepresentationWithReference]) -> Signal<(TransformImageArguments) -> DrawingContext?, NoError> { let signal = avatarGalleryThumbnailDatas(postbox: account.postbox, representations: representations, fullRepresentationSize: CGSize(width: 127.0, height: 127.0), autoFetchFullSize: true) return signal |> map { (thumbnailData, fullSizeData, fullSizeComplete) in @@ -2129,8 +2145,8 @@ func instantPageImageFile(account: Account, fileReference: FileMediaReference, f } } -private func avatarGalleryPhotoDatas(account: Account, representations: [(TelegramMediaImageRepresentation, MediaResourceReference)], autoFetchFullSize: Bool = false) -> Signal<(Data?, Data?, Bool), NoError> { - if let smallestRepresentation = smallestImageRepresentation(representations.map({ $0.0 })), let largestRepresentation = largestImageRepresentation(representations.map({ $0.0 })), let smallestIndex = representations.index(where: { $0.0 == smallestRepresentation }), let largestIndex = representations.index(where: { $0.0 == largestRepresentation }) { +private func avatarGalleryPhotoDatas(account: Account, representations: [ImageRepresentationWithReference], autoFetchFullSize: Bool = false) -> Signal<(Data?, Data?, Bool), NoError> { + if let smallestRepresentation = smallestImageRepresentation(representations.map({ $0.representation })), let largestRepresentation = largestImageRepresentation(representations.map({ $0.representation })), let smallestIndex = representations.index(where: { $0.representation == smallestRepresentation }), let largestIndex = representations.index(where: { $0.representation == largestRepresentation }) { let maybeFullSize = account.postbox.mediaBox.resourceData(largestRepresentation.resource) let signal = maybeFullSize @@ -2140,8 +2156,8 @@ private func avatarGalleryPhotoDatas(account: Account, representations: [(Telegr let loadedData: Data? = try? Data(contentsOf: URL(fileURLWithPath: maybeData.path), options: []) return .single((nil, loadedData, true)) } else { - let fetchedThumbnail = fetchedMediaResource(postbox: account.postbox, reference: representations[smallestIndex].1) - let fetchedFullSize = fetchedMediaResource(postbox: account.postbox, reference: representations[largestIndex].1) + let fetchedThumbnail = fetchedMediaResource(postbox: account.postbox, reference: representations[smallestIndex].reference) + let fetchedFullSize = fetchedMediaResource(postbox: account.postbox, reference: representations[largestIndex].reference) let thumbnail = Signal { subscriber in let fetchedDisposable = fetchedThumbnail.start() @@ -2191,7 +2207,7 @@ private func avatarGalleryPhotoDatas(account: Account, representations: [(Telegr } } -func chatAvatarGalleryPhoto(account: Account, representations: [(TelegramMediaImageRepresentation, MediaResourceReference)], autoFetchFullSize: Bool = false) -> Signal<(TransformImageArguments) -> DrawingContext?, NoError> { +func chatAvatarGalleryPhoto(account: Account, representations: [ImageRepresentationWithReference], autoFetchFullSize: Bool = false) -> Signal<(TransformImageArguments) -> DrawingContext?, NoError> { let signal = avatarGalleryPhotoDatas(account: account, representations: representations, autoFetchFullSize: autoFetchFullSize) return signal diff --git a/TelegramUI/PresentationCallManager.swift b/TelegramUI/PresentationCallManager.swift index fa6118b07b..0e805f79be 100644 --- a/TelegramUI/PresentationCallManager.swift +++ b/TelegramUI/PresentationCallManager.swift @@ -261,38 +261,65 @@ public final class PresentationCallManager { return .alreadyInProgress(call.peerId) } if let _ = callKitIntegrationIfEnabled(self.callKitIntegration, settings: self.callSettings?.0) { - let (presentationData, present, openSettings) = self.getDeviceAccessData() - - let accessEnabledSignal: Signal = Signal { subscriber in - DeviceAccess.authorizeAccess(to: .microphone(.voiceCall), presentationData: presentationData, present: { c, a in - present(c, a) - }, openSettings: { - openSettings() - }, { value in - subscriber.putNext(value) - subscriber.putCompletion() - }) - return EmptyDisposable - } - |> runOn(Queue.mainQueue()) - let postbox = self.account.postbox - self.startCallDisposable.set((accessEnabledSignal - |> mapToSignal { accessEnabled -> Signal in - if !accessEnabled { - return .single(nil) - } - return postbox.loadedPeerWithId(peerId) - |> take(1) - |> map(Optional.init) - } - |> deliverOnMainQueue).start(next: { [weak self] peer in - guard let strongSelf = self, let peer = peer else { + let begin: () -> Void = { [weak self] in + guard let strongSelf = self else { return } - strongSelf.callKitIntegration?.startCall(peerId: peerId, displayTitle: peer.displayTitle) - })) + let (presentationData, present, openSettings) = strongSelf.getDeviceAccessData() + + let accessEnabledSignal: Signal = Signal { subscriber in + DeviceAccess.authorizeAccess(to: .microphone(.voiceCall), presentationData: presentationData, present: { c, a in + present(c, a) + }, openSettings: { + openSettings() + }, { value in + subscriber.putNext(value) + subscriber.putCompletion() + }) + return EmptyDisposable + } + |> runOn(Queue.mainQueue()) + let postbox = strongSelf.account.postbox + strongSelf.startCallDisposable.set((accessEnabledSignal + |> mapToSignal { accessEnabled -> Signal in + if !accessEnabled { + return .single(nil) + } + return postbox.loadedPeerWithId(peerId) + |> take(1) + |> map(Optional.init) + } + |> deliverOnMainQueue).start(next: { peer in + guard let strongSelf = self, let peer = peer else { + return + } + strongSelf.callKitIntegration?.startCall(peerId: peerId, displayTitle: peer.displayTitle) + })) + } + if let currentCall = self.currentCall { + self.callKitIntegration?.dropCall(uuid: currentCall.internalId) + self.startCallDisposable.set((currentCall.hangUp() + |> deliverOnMainQueue).start(next: { _ in + begin() + })) + } else { + begin() + } } else { - let _ = self.startCall(peerId: peerId).start() + let begin: () -> Void = { [weak self] in + guard let strongSelf = self else { + return + } + let _ = strongSelf.startCall(peerId: peerId).start() + } + if let currentCall = self.currentCall { + self.startCallDisposable.set((currentCall.hangUp() + |> deliverOnMainQueue).start(next: { _ in + begin() + })) + } else { + begin() + } } return .requested } diff --git a/TelegramUI/PresentationStrings.swift b/TelegramUI/PresentationStrings.swift index 13e6035dee..53a44979f5 100644 --- a/TelegramUI/PresentationStrings.swift +++ b/TelegramUI/PresentationStrings.swift @@ -269,224 +269,224 @@ public final class PresentationStrings { public func DialogList_PinLimitError(_ _0: String) -> (String, [(Int, NSRange)]) { return formatWithArgumentRanges(self._s[80]!, self._r[80]!, [_0]) } - public var Permissions_ContactsTitle: String { return self._s[82]! } - public var Conversation_StopLiveLocation: String { return self._s[83]! } - public var Channel_AdminLogFilter_EventsAll: String { return self._s[84]! } - public var GroupInfo_InviteLink_CopyAlert_Success: String { return self._s[86]! } - public var Username_LinkCopied: String { return self._s[88]! } - public var SecretVideo_Title: String { return self._s[89]! } - public var AccessDenied_PhotosAndVideos: String { return self._s[90]! } - public var Map_OpenInGoogleMaps: String { return self._s[91]! } + public var Conversation_StopLiveLocation: String { return self._s[82]! } + public var Channel_AdminLogFilter_EventsAll: String { return self._s[83]! } + public var GroupInfo_InviteLink_CopyAlert_Success: String { return self._s[85]! } + public var Username_LinkCopied: String { return self._s[87]! } + public var SecretVideo_Title: String { return self._s[88]! } + public var AccessDenied_PhotosAndVideos: String { return self._s[89]! } + public var Map_OpenInGoogleMaps: String { return self._s[90]! } public func Time_PreciseDate_m12(_ _1: String, _ _2: String, _ _3: String) -> (String, [(Int, NSRange)]) { - return formatWithArgumentRanges(self._s[92]!, self._r[92]!, [_1, _2, _3]) + return formatWithArgumentRanges(self._s[91]!, self._r[91]!, [_1, _2, _3]) } public func Channel_AdminLog_MessageKickedNameUsername(_ _1: String, _ _2: String) -> (String, [(Int, NSRange)]) { - return formatWithArgumentRanges(self._s[93]!, self._r[93]!, [_1, _2]) + return formatWithArgumentRanges(self._s[92]!, self._r[92]!, [_1, _2]) } - public var Call_StatusRinging: String { return self._s[94]! } - public var Group_Username_InvalidStartsWithNumber: String { return self._s[95]! } - public var UserInfo_NotificationsEnabled: String { return self._s[96]! } - public var Map_Search: String { return self._s[97]! } - public var Login_TermsOfServiceHeader: String { return self._s[99]! } + public var Call_StatusRinging: String { return self._s[93]! } + public var Group_Username_InvalidStartsWithNumber: String { return self._s[94]! } + public var UserInfo_NotificationsEnabled: String { return self._s[95]! } + public var Map_Search: String { return self._s[96]! } + public var Login_TermsOfServiceHeader: String { return self._s[98]! } public func Notification_PinnedVideoMessage(_ _0: String) -> (String, [(Int, NSRange)]) { - return formatWithArgumentRanges(self._s[100]!, self._r[100]!, [_0]) + return formatWithArgumentRanges(self._s[99]!, self._r[99]!, [_0]) } public func Channel_AdminLog_MessageToggleSignaturesOn(_ _0: String) -> (String, [(Int, NSRange)]) { - return formatWithArgumentRanges(self._s[101]!, self._r[101]!, [_0]) + return formatWithArgumentRanges(self._s[100]!, self._r[100]!, [_0]) } - public var TwoStepAuth_SetupPasswordConfirmPassword: String { return self._s[102]! } - public var Weekday_Today: String { return self._s[103]! } - public var Permissions_ContactsAllow: String { return self._s[104]! } + public var TwoStepAuth_SetupPasswordConfirmPassword: String { return self._s[101]! } + public var Weekday_Today: String { return self._s[102]! } public func InstantPage_AuthorAndDateTitle(_ _1: String, _ _2: String) -> (String, [(Int, NSRange)]) { - return formatWithArgumentRanges(self._s[106]!, self._r[106]!, [_1, _2]) + return formatWithArgumentRanges(self._s[104]!, self._r[104]!, [_1, _2]) } public func Conversation_MessageDialogRetryAll(_ _1: Int) -> (String, [(Int, NSRange)]) { - return formatWithArgumentRanges(self._s[107]!, self._r[107]!, ["\(_1)"]) + return formatWithArgumentRanges(self._s[105]!, self._r[105]!, ["\(_1)"]) } - public var Notification_PassportValuePersonalDetails: String { return self._s[109]! } - public var Channel_AdminLog_MessagePreviousLink: String { return self._s[110]! } - public var ChangePhoneNumberNumber_NewNumber: String { return self._s[111]! } - public var ApplyLanguage_LanguageNotSupportedError: String { return self._s[112]! } - public var TwoStepAuth_ChangePasswordDescription: String { return self._s[113]! } - public var PhotoEditor_BlurToolLinear: String { return self._s[114]! } - public var Contacts_PermissionsAllowInSettings: String { return self._s[115]! } - public var Weekday_ShortMonday: String { return self._s[116]! } - public var Cache_KeepMedia: String { return self._s[117]! } - public var Passport_FieldIdentitySelfieHelp: String { return self._s[118]! } - public var Conversation_ClousStorageInfo_Description4: String { return self._s[119]! } - public var Passport_Language_ru: String { return self._s[120]! } + public var Notification_PassportValuePersonalDetails: String { return self._s[107]! } + public var Channel_AdminLog_MessagePreviousLink: String { return self._s[108]! } + public var ChangePhoneNumberNumber_NewNumber: String { return self._s[109]! } + public var ApplyLanguage_LanguageNotSupportedError: String { return self._s[110]! } + public var TwoStepAuth_ChangePasswordDescription: String { return self._s[111]! } + public var PhotoEditor_BlurToolLinear: String { return self._s[112]! } + public var Contacts_PermissionsAllowInSettings: String { return self._s[113]! } + public var Weekday_ShortMonday: String { return self._s[114]! } + public var Cache_KeepMedia: String { return self._s[115]! } + public var Passport_FieldIdentitySelfieHelp: String { return self._s[116]! } + public var Conversation_ClousStorageInfo_Description4: String { return self._s[117]! } + public var Passport_Language_ru: String { return self._s[118]! } public func Notification_CreatedChatWithTitle(_ _0: String, _ _1: String) -> (String, [(Int, NSRange)]) { - return formatWithArgumentRanges(self._s[121]!, self._r[121]!, [_0, _1]) + return formatWithArgumentRanges(self._s[119]!, self._r[119]!, [_0, _1]) } public func CHAT_MESSAGES(_ _1: String, _ _2: String, _ _3: String) -> (String, [(Int, NSRange)]) { - return formatWithArgumentRanges(self._s[122]!, self._r[122]!, [_1, _2, _3]) + return formatWithArgumentRanges(self._s[120]!, self._r[120]!, [_1, _2, _3]) } - public var TwoStepAuth_RecoveryUnavailable: String { return self._s[123]! } - public var EnterPasscode_TouchId: String { return self._s[124]! } - public var PhotoEditor_QualityVeryHigh: String { return self._s[127]! } - public var Checkout_NewCard_SaveInfo: String { return self._s[129]! } - public var ChatSettings_AutoDownloadEnabled: String { return self._s[132]! } - public var NetworkUsageSettings_BytesSent: String { return self._s[133]! } - public var Checkout_PasswordEntry_Pay: String { return self._s[134]! } - public var AuthSessions_TerminateSession: String { return self._s[135]! } - public var Message_File: String { return self._s[136]! } - public var MediaPicker_VideoMuteDescription: String { return self._s[137]! } - public var SocksProxySetup_ProxyStatusConnected: String { return self._s[138]! } - public var TwoStepAuth_RecoveryCode: String { return self._s[139]! } - public var EnterPasscode_EnterCurrentPasscode: String { return self._s[140]! } + public var TwoStepAuth_RecoveryUnavailable: String { return self._s[121]! } + public var EnterPasscode_TouchId: String { return self._s[122]! } + public var PhotoEditor_QualityVeryHigh: String { return self._s[125]! } + public var Checkout_NewCard_SaveInfo: String { return self._s[127]! } + public var ChatSettings_AutoDownloadEnabled: String { return self._s[130]! } + public var NetworkUsageSettings_BytesSent: String { return self._s[131]! } + public var Checkout_PasswordEntry_Pay: String { return self._s[132]! } + public var AuthSessions_TerminateSession: String { return self._s[133]! } + public var Message_File: String { return self._s[134]! } + public var MediaPicker_VideoMuteDescription: String { return self._s[135]! } + public var SocksProxySetup_ProxyStatusConnected: String { return self._s[136]! } + public var TwoStepAuth_RecoveryCode: String { return self._s[137]! } + public var EnterPasscode_EnterCurrentPasscode: String { return self._s[138]! } public func TwoStepAuth_EnterPasswordHint(_ _0: String) -> (String, [(Int, NSRange)]) { - return formatWithArgumentRanges(self._s[141]!, self._r[141]!, [_0]) + return formatWithArgumentRanges(self._s[139]!, self._r[139]!, [_0]) } - public var Conversation_Moderate_Report: String { return self._s[143]! } - public var TwoStepAuth_EmailInvalid: String { return self._s[144]! } - public var Passport_Language_ms: String { return self._s[145]! } - public var Channel_Edit_AboutItem: String { return self._s[147]! } - public var DialogList_SearchSectionGlobal: String { return self._s[151]! } - public var PasscodeSettings_TurnPasscodeOn: String { return self._s[152]! } - public var Channel_BanUser_Title: String { return self._s[153]! } - public var ChatSearch_SearchPlaceholder: String { return self._s[155]! } - public var Passport_FieldAddressTranslationHelp: String { return self._s[156]! } - public var NotificationsSound_Aurora: String { return self._s[157]! } + public var Conversation_Moderate_Report: String { return self._s[141]! } + public var TwoStepAuth_EmailInvalid: String { return self._s[142]! } + public var Passport_Language_ms: String { return self._s[143]! } + public var Channel_Edit_AboutItem: String { return self._s[145]! } + public var DialogList_SearchSectionGlobal: String { return self._s[149]! } + public var PasscodeSettings_TurnPasscodeOn: String { return self._s[150]! } + public var Channel_BanUser_Title: String { return self._s[151]! } + public var ChatSearch_SearchPlaceholder: String { return self._s[153]! } + public var Passport_FieldAddressTranslationHelp: String { return self._s[154]! } + public var NotificationsSound_Aurora: String { return self._s[155]! } public func FileSize_GB(_ _0: String) -> (String, [(Int, NSRange)]) { - return formatWithArgumentRanges(self._s[158]!, self._r[158]!, [_0]) + return formatWithArgumentRanges(self._s[156]!, self._r[156]!, [_0]) } - public var AuthSessions_LoggedInWithTelegram: String { return self._s[161]! } + public var AuthSessions_LoggedInWithTelegram: String { return self._s[159]! } public func Privacy_GroupsAndChannels_InviteToGroupError(_ _0: String, _ _1: String) -> (String, [(Int, NSRange)]) { - return formatWithArgumentRanges(self._s[162]!, self._r[162]!, [_0, _1]) + return formatWithArgumentRanges(self._s[160]!, self._r[160]!, [_0, _1]) } - public var Passport_PasswordNext: String { return self._s[163]! } - public var Bot_GroupStatusReadsHistory: String { return self._s[164]! } - public var Settings_FAQ_Intro: String { return self._s[166]! } - public var PrivacySettings_PasscodeAndTouchId: String { return self._s[168]! } - public var FeaturedStickerPacks_Title: String { return self._s[169]! } - public var TwoStepAuth_PasswordRemoveConfirmation: String { return self._s[170]! } - public var Username_Title: String { return self._s[171]! } - public var Localization_LanguageOther: String { return self._s[172]! } - public var Stickers_SuggestStickers: String { return self._s[173]! } + public var Passport_PasswordNext: String { return self._s[161]! } + public var Bot_GroupStatusReadsHistory: String { return self._s[162]! } + public var Settings_FAQ_Intro: String { return self._s[164]! } + public var PrivacySettings_PasscodeAndTouchId: String { return self._s[166]! } + public var FeaturedStickerPacks_Title: String { return self._s[167]! } + public var TwoStepAuth_PasswordRemoveConfirmation: String { return self._s[168]! } + public var Username_Title: String { return self._s[169]! } + public var Localization_LanguageOther: String { return self._s[170]! } + public var Stickers_SuggestStickers: String { return self._s[171]! } public func Channel_AdminLog_MessageRemovedGroupUsername(_ _0: String) -> (String, [(Int, NSRange)]) { + return formatWithArgumentRanges(self._s[172]!, self._r[172]!, [_0]) + } + public var Channel_AdminLogFilter_EventsAdmins: String { return self._s[173]! } + public func Notification_PinnedDeletedMessage(_ _0: String) -> (String, [(Int, NSRange)]) { return formatWithArgumentRanges(self._s[174]!, self._r[174]!, [_0]) } - public var Channel_AdminLogFilter_EventsAdmins: String { return self._s[175]! } - public func Notification_PinnedDeletedMessage(_ _0: String) -> (String, [(Int, NSRange)]) { - return formatWithArgumentRanges(self._s[176]!, self._r[176]!, [_0]) - } - public var Group_UpgradeConfirmation: String { return self._s[177]! } - public var DialogList_Unpin: String { return self._s[178]! } - public var Passport_Identity_DateOfBirth: String { return self._s[179]! } - public var Month_ShortOctober: String { return self._s[180]! } - public var Notification_CallCanceledShort: String { return self._s[181]! } - public var Passport_Phone_Help: String { return self._s[182]! } - public var Passport_Language_az: String { return self._s[183]! } - public var Passport_Identity_DocumentNumber: String { return self._s[185]! } - public var PhotoEditor_CurvesRed: String { return self._s[186]! } - public var PhoneNumberHelp_Alert: String { return self._s[188]! } - public var SocksProxySetup_Port: String { return self._s[189]! } - public var Checkout_PayNone: String { return self._s[190]! } - public var AutoDownloadSettings_WiFi: String { return self._s[191]! } - public var GroupInfo_GroupType: String { return self._s[192]! } - public var StickerSettings_ContextHide: String { return self._s[193]! } - public var Passport_Address_OneOfTypeTemporaryRegistration: String { return self._s[194]! } + public var Group_UpgradeConfirmation: String { return self._s[175]! } + public var DialogList_Unpin: String { return self._s[176]! } + public var Passport_Identity_DateOfBirth: String { return self._s[177]! } + public var Month_ShortOctober: String { return self._s[178]! } + public var Notification_CallCanceledShort: String { return self._s[179]! } + public var Passport_Phone_Help: String { return self._s[180]! } + public var Passport_Language_az: String { return self._s[181]! } + public var Passport_Identity_DocumentNumber: String { return self._s[183]! } + public var PhotoEditor_CurvesRed: String { return self._s[184]! } + public var PhoneNumberHelp_Alert: String { return self._s[186]! } + public var SocksProxySetup_Port: String { return self._s[187]! } + public var Checkout_PayNone: String { return self._s[188]! } + public var AutoDownloadSettings_WiFi: String { return self._s[189]! } + public var GroupInfo_GroupType: String { return self._s[190]! } + public var StickerSettings_ContextHide: String { return self._s[191]! } + public var Passport_Address_OneOfTypeTemporaryRegistration: String { return self._s[192]! } public func CHAT_RETURNED(_ _1: String, _ _2: String) -> (String, [(Int, NSRange)]) { - return formatWithArgumentRanges(self._s[195]!, self._r[195]!, [_1, _2]) + return formatWithArgumentRanges(self._s[193]!, self._r[193]!, [_1, _2]) } - public var Group_Setup_HistoryTitle: String { return self._s[197]! } - public var Passport_Identity_FilesUploadNew: String { return self._s[198]! } - public var PasscodeSettings_AutoLock: String { return self._s[199]! } - public var Passport_Title: String { return self._s[200]! } - public var Channel_AdminLogFilter_EventsNewSubscribers: String { return self._s[201]! } - public var State_WaitingForNetwork: String { return self._s[203]! } + public var Group_Setup_HistoryTitle: String { return self._s[195]! } + public var Passport_Identity_FilesUploadNew: String { return self._s[196]! } + public var PasscodeSettings_AutoLock: String { return self._s[197]! } + public var Passport_Title: String { return self._s[198]! } + public var Channel_AdminLogFilter_EventsNewSubscribers: String { return self._s[199]! } + public var State_WaitingForNetwork: String { return self._s[201]! } public func Notification_Invited(_ _0: String, _ _1: String) -> (String, [(Int, NSRange)]) { - return formatWithArgumentRanges(self._s[204]!, self._r[204]!, [_0, _1]) + return formatWithArgumentRanges(self._s[202]!, self._r[202]!, [_0, _1]) } - public var Calls_NotNow: String { return self._s[206]! } - public var UserInfo_SendMessage: String { return self._s[207]! } - public var TwoStepAuth_PasswordSet: String { return self._s[208]! } - public var Passport_DeleteDocument: String { return self._s[209]! } - public var SocksProxySetup_AddProxyTitle: String { return self._s[210]! } - public var Passport_FieldIdentity: String { return self._s[211]! } + public var Calls_NotNow: String { return self._s[204]! } + public var UserInfo_SendMessage: String { return self._s[205]! } + public var TwoStepAuth_PasswordSet: String { return self._s[206]! } + public var Passport_DeleteDocument: String { return self._s[207]! } + public var SocksProxySetup_AddProxyTitle: String { return self._s[208]! } + public var Passport_FieldIdentity: String { return self._s[209]! } public func CHAT_MESSAGE_FWDS(_ _1: String, _ _2: String, _ _3: String) -> (String, [(Int, NSRange)]) { - return formatWithArgumentRanges(self._s[212]!, self._r[212]!, [_1, _2, _3]) + return formatWithArgumentRanges(self._s[210]!, self._r[210]!, [_1, _2, _3]) } - public var Group_Setup_TypePrivateHelp: String { return self._s[213]! } - public var Conversation_Processing: String { return self._s[215]! } + public var Group_Setup_TypePrivateHelp: String { return self._s[211]! } + public var Conversation_Processing: String { return self._s[213]! } public func MESSAGE_CONTACT(_ _1: String) -> (String, [(Int, NSRange)]) { - return formatWithArgumentRanges(self._s[216]!, self._r[216]!, [_1]) + return formatWithArgumentRanges(self._s[214]!, self._r[214]!, [_1]) } public func MESSAGE_ROUND(_ _1: String) -> (String, [(Int, NSRange)]) { - return formatWithArgumentRanges(self._s[218]!, self._r[218]!, [_1]) + return formatWithArgumentRanges(self._s[216]!, self._r[216]!, [_1]) } - public var ChatSettings_AutoPlayAnimations: String { return self._s[219]! } - public var AuthSessions_LogOutApplicationsHelp: String { return self._s[222]! } - public var Month_GenFebruary: String { return self._s[223]! } - public var Passport_Identity_TypeIdentityCard: String { return self._s[225]! } - public var GroupInfo_AddParticipant: String { return self._s[227]! } - public var KeyCommand_SendMessage: String { return self._s[228]! } - public var Map_LiveLocationShowAll: String { return self._s[230]! } - public var Checkout_Receipt_Title: String { return self._s[232]! } - public var Message_Contact: String { return self._s[233]! } - public var Call_StatusIncoming: String { return self._s[234]! } + public var ChatSettings_AutoPlayAnimations: String { return self._s[217]! } + public var AuthSessions_LogOutApplicationsHelp: String { return self._s[220]! } + public var Month_GenFebruary: String { return self._s[221]! } + public var Passport_Identity_TypeIdentityCard: String { return self._s[223]! } + public var GroupInfo_AddParticipant: String { return self._s[225]! } + public var KeyCommand_SendMessage: String { return self._s[226]! } + public var Map_LiveLocationShowAll: String { return self._s[228]! } + public var Checkout_Receipt_Title: String { return self._s[230]! } + public var Message_Contact: String { return self._s[231]! } + public var Call_StatusIncoming: String { return self._s[232]! } public func Channel_AdminLog_MessageKickedName(_ _1: String) -> (String, [(Int, NSRange)]) { - return formatWithArgumentRanges(self._s[235]!, self._r[235]!, [_1]) + return formatWithArgumentRanges(self._s[233]!, self._r[233]!, [_1]) } - public var Passport_FieldIdentityDetailsHelp: String { return self._s[237]! } - public var Conversation_ViewChannel: String { return self._s[238]! } + public var Passport_FieldIdentityDetailsHelp: String { return self._s[235]! } + public var Conversation_ViewChannel: String { return self._s[236]! } public func Time_TodayAt(_ _0: String) -> (String, [(Int, NSRange)]) { - return formatWithArgumentRanges(self._s[239]!, self._r[239]!, [_0]) + return formatWithArgumentRanges(self._s[237]!, self._r[237]!, [_0]) } - public var Passport_Language_nl: String { return self._s[241]! } - public var Camera_Retake: String { return self._s[242]! } - public var ApplyLanguage_ApplySuccess: String { return self._s[243]! } - public var AuthSessions_LogOutApplications: String { return self._s[244]! } - public var Tour_Title6: String { return self._s[245]! } - public var Map_ChooseAPlace: String { return self._s[246]! } - public var CallSettings_Never: String { return self._s[248]! } + public var Passport_Language_nl: String { return self._s[239]! } + public var Camera_Retake: String { return self._s[240]! } + public var ApplyLanguage_ApplySuccess: String { return self._s[241]! } + public var AuthSessions_LogOutApplications: String { return self._s[242]! } + public var Tour_Title6: String { return self._s[243]! } + public var Map_ChooseAPlace: String { return self._s[244]! } + public var CallSettings_Never: String { return self._s[246]! } public func Notification_ChangedGroupPhoto(_ _0: String) -> (String, [(Int, NSRange)]) { - return formatWithArgumentRanges(self._s[249]!, self._r[249]!, [_0]) + return formatWithArgumentRanges(self._s[247]!, self._r[247]!, [_0]) } - public var GroupInfo_InviteLink_Title: String { return self._s[250]! } + public var GroupInfo_InviteLink_Title: String { return self._s[248]! } public func Channel_AdminLog_MessageUnkickedNameUsername(_ _1: String, _ _2: String) -> (String, [(Int, NSRange)]) { - return formatWithArgumentRanges(self._s[251]!, self._r[251]!, [_1, _2]) + return formatWithArgumentRanges(self._s[249]!, self._r[249]!, [_1, _2]) } - public var KeyCommand_ScrollUp: String { return self._s[252]! } - public var ContactInfo_URLLabelHomepage: String { return self._s[253]! } + public var KeyCommand_ScrollUp: String { return self._s[250]! } + public var ContactInfo_URLLabelHomepage: String { return self._s[251]! } public func Conversation_EncryptedPlaceholderTitleOutgoing(_ _0: String) -> (String, [(Int, NSRange)]) { - return formatWithArgumentRanges(self._s[254]!, self._r[254]!, [_0]) + return formatWithArgumentRanges(self._s[252]!, self._r[252]!, [_0]) } - public var Watch_LastSeen_WithinAWeek: String { return self._s[255]! } - public var Weekday_Tuesday: String { return self._s[256]! } - public var UserInfo_StartSecretChat: String { return self._s[257]! } - public var Passport_Identity_FilesTitle: String { return self._s[258]! } - public var DialogList_DeleteConversationConfirmation: String { return self._s[259]! } - public var AuthSessions_Sessions: String { return self._s[260]! } - public var TwoStepAuth_RecoveryEmailChangeDescription: String { return self._s[262]! } - public var Call_StatusWaiting: String { return self._s[263]! } - public var CreateGroup_SoftUserLimitAlert: String { return self._s[264]! } - public var FastTwoStepSetup_HintHelp: String { return self._s[265]! } + public var Watch_LastSeen_WithinAWeek: String { return self._s[253]! } + public var Weekday_Tuesday: String { return self._s[254]! } + public var UserInfo_StartSecretChat: String { return self._s[255]! } + public var Passport_Identity_FilesTitle: String { return self._s[256]! } + public var Permissions_NotificationsAllow_v0: String { return self._s[257]! } + public var DialogList_DeleteConversationConfirmation: String { return self._s[258]! } + public var AuthSessions_Sessions: String { return self._s[259]! } + public var TwoStepAuth_RecoveryEmailChangeDescription: String { return self._s[261]! } + public var Call_StatusWaiting: String { return self._s[262]! } + public var CreateGroup_SoftUserLimitAlert: String { return self._s[263]! } + public var FastTwoStepSetup_HintHelp: String { return self._s[264]! } public func MESSAGE_VIDEO(_ _1: String) -> (String, [(Int, NSRange)]) { - return formatWithArgumentRanges(self._s[266]!, self._r[266]!, [_1]) + return formatWithArgumentRanges(self._s[265]!, self._r[265]!, [_1]) } - public var Settings_LogoutConfirmationText: String { return self._s[267]! } - public var Passport_Identity_TypePassport: String { return self._s[269]! } - public var SocksProxySetup_SaveProxy: String { return self._s[272]! } - public var AccessDenied_SaveMedia: String { return self._s[273]! } - public var Checkout_ErrorInvoiceAlreadyPaid: String { return self._s[275]! } - public var Settings_Title: String { return self._s[277]! } - public var Contacts_InviteSearchLabel: String { return self._s[279]! } - public var ConvertToSupergroup_Title: String { return self._s[280]! } + public var Settings_LogoutConfirmationText: String { return self._s[266]! } + public var Passport_Identity_TypePassport: String { return self._s[268]! } + public var SocksProxySetup_SaveProxy: String { return self._s[271]! } + public var AccessDenied_SaveMedia: String { return self._s[272]! } + public var Checkout_ErrorInvoiceAlreadyPaid: String { return self._s[274]! } + public var Settings_Title: String { return self._s[276]! } + public var Contacts_InviteSearchLabel: String { return self._s[278]! } + public var ConvertToSupergroup_Title: String { return self._s[279]! } public func Channel_AdminLog_CaptionEdited(_ _0: String) -> (String, [(Int, NSRange)]) { - return formatWithArgumentRanges(self._s[281]!, self._r[281]!, [_0]) + return formatWithArgumentRanges(self._s[280]!, self._r[280]!, [_0]) } - public var InfoPlist_NSSiriUsageDescription: String { return self._s[282]! } - public var ChatSettings_AutomaticPhotoDownload: String { return self._s[283]! } - public var UserInfo_BotHelp: String { return self._s[284]! } - public var PrivacySettings_LastSeenEverybody: String { return self._s[285]! } - public var Checkout_Name: String { return self._s[286]! } - public var Channel_BanUser_BlockFor: String { return self._s[287]! } - public var Checkout_ShippingAddress: String { return self._s[288]! } - public var Privacy_PaymentsClearInfoDoneHelp: String { return self._s[289]! } + public var InfoPlist_NSSiriUsageDescription: String { return self._s[281]! } + public var ChatSettings_AutomaticPhotoDownload: String { return self._s[282]! } + public var UserInfo_BotHelp: String { return self._s[283]! } + public var PrivacySettings_LastSeenEverybody: String { return self._s[284]! } + public var Checkout_Name: String { return self._s[285]! } + public var Channel_BanUser_BlockFor: String { return self._s[286]! } + public var Checkout_ShippingAddress: String { return self._s[287]! } + public var Privacy_PaymentsClearInfoDoneHelp: String { return self._s[288]! } public func SecretVideo_NotViewedYet(_ _0: String) -> (String, [(Int, NSRange)]) { - return formatWithArgumentRanges(self._s[292]!, self._r[292]!, [_0]) + return formatWithArgumentRanges(self._s[291]!, self._r[291]!, [_0]) } + public var Group_LeaveGroup: String { return self._s[292]! } public var Settings_UsernameEmpty: String { return self._s[293]! } public func TwoStepAuth_ConfirmEmailDescription(_ _1: String) -> (String, [(Int, NSRange)]) { return formatWithArgumentRanges(self._s[294]!, self._r[294]!, [_1]) @@ -567,1726 +567,1728 @@ public final class PresentationStrings { public func CHANNEL_MESSAGE_GIF(_ _1: String) -> (String, [(Int, NSRange)]) { return formatWithArgumentRanges(self._s[362]!, self._r[362]!, [_1]) } - public var Permissions_NotificationsTitle: String { return self._s[364]! } + public var PhotoEditor_QualityHigh: String { return self._s[364]! } public func Passport_Phone_UseTelegramNumber(_ _0: String) -> (String, [(Int, NSRange)]) { return formatWithArgumentRanges(self._s[365]!, self._r[365]!, [_0]) } - public var PhotoEditor_QualityHigh: String { return self._s[366]! } - public var ApplyLanguage_ApplyLanguageAction: String { return self._s[367]! } - public var Message_LiveLocation: String { return self._s[368]! } - public var Conversation_SendMessage: String { return self._s[369]! } - public var AuthSessions_EmptyTitle: String { return self._s[370]! } - public var Permissions_NotificationsAllowInSettings: String { return self._s[371]! } - public var CallSettings_UseLessData: String { return self._s[372]! } - public var NetworkUsageSettings_MediaDocumentDataSection: String { return self._s[373]! } - public var Stickers_AddToFavorites: String { return self._s[374]! } - public var PhotoEditor_QualityLow: String { return self._s[375]! } - public var Watch_UserInfo_Unblock: String { return self._s[376]! } - public var Settings_Logout: String { return self._s[377]! } - public var ContactInfo_PhoneLabelWork: String { return self._s[378]! } + public var ApplyLanguage_ApplyLanguageAction: String { return self._s[366]! } + public var Message_LiveLocation: String { return self._s[367]! } + public var Conversation_SendMessage: String { return self._s[368]! } + public var AuthSessions_EmptyTitle: String { return self._s[369]! } + public var CallSettings_UseLessData: String { return self._s[370]! } + public var NetworkUsageSettings_MediaDocumentDataSection: String { return self._s[371]! } + public var Stickers_AddToFavorites: String { return self._s[372]! } + public var PhotoEditor_QualityLow: String { return self._s[373]! } + public var Watch_UserInfo_Unblock: String { return self._s[374]! } + public var Settings_Logout: String { return self._s[375]! } + public var ContactInfo_PhoneLabelWork: String { return self._s[376]! } public func Date_ChatDateHeader(_ _1: String, _ _2: String) -> (String, [(Int, NSRange)]) { - return formatWithArgumentRanges(self._s[379]!, self._r[379]!, [_1, _2]) + return formatWithArgumentRanges(self._s[377]!, self._r[377]!, [_1, _2]) } public func Message_ForwardedMessage(_ _0: String) -> (String, [(Int, NSRange)]) { - return formatWithArgumentRanges(self._s[380]!, self._r[380]!, [_0]) + return formatWithArgumentRanges(self._s[378]!, self._r[378]!, [_0]) } - public var Watch_Notification_Joined: String { return self._s[381]! } - public var Group_Setup_TypePublicHelp: String { return self._s[382]! } - public var Passport_Scans_UploadNew: String { return self._s[383]! } - public var Checkout_LiabilityAlertTitle: String { return self._s[384]! } - public var DialogList_Title: String { return self._s[385]! } - public var NotificationSettings_ContactJoined: String { return self._s[386]! } - public var GroupInfo_LabelAdmin: String { return self._s[387]! } - public var KeyCommand_ChatInfo: String { return self._s[388]! } - public var Conversation_EditingCaptionPanelTitle: String { return self._s[389]! } - public var Call_ReportIncludeLog: String { return self._s[390]! } + public var Watch_Notification_Joined: String { return self._s[379]! } + public var Group_Setup_TypePublicHelp: String { return self._s[380]! } + public var Passport_Scans_UploadNew: String { return self._s[381]! } + public var Checkout_LiabilityAlertTitle: String { return self._s[382]! } + public var DialogList_Title: String { return self._s[383]! } + public var NotificationSettings_ContactJoined: String { return self._s[384]! } + public var GroupInfo_LabelAdmin: String { return self._s[385]! } + public var KeyCommand_ChatInfo: String { return self._s[386]! } + public var Conversation_EditingCaptionPanelTitle: String { return self._s[387]! } + public var Call_ReportIncludeLog: String { return self._s[388]! } public func Notifications_ExceptionsChangeSound(_ _0: String) -> (String, [(Int, NSRange)]) { - return formatWithArgumentRanges(self._s[393]!, self._r[393]!, [_0]) + return formatWithArgumentRanges(self._s[391]!, self._r[391]!, [_0]) } - public var ChatAdmins_AllMembersAreAdmins: String { return self._s[394]! } - public var Message_Sticker: String { return self._s[395]! } - public var LastSeen_JustNow: String { return self._s[397]! } - public var Passport_Email_EmailPlaceholder: String { return self._s[399]! } - public var Channel_AdminLogFilter_EventsEditedMessages: String { return self._s[400]! } - public var Channel_EditAdmin_PermissionsHeader: String { return self._s[401]! } - public var TwoStepAuth_Email: String { return self._s[402]! } - public var PhotoEditor_BlurToolOff: String { return self._s[403]! } - public var Message_PinnedStickerMessage: String { return self._s[404]! } - public var ContactInfo_PhoneLabelPager: String { return self._s[405]! } - public var Passport_DiscardMessageTitle: String { return self._s[406]! } - public var Privacy_PaymentsTitle: String { return self._s[407]! } + public var ChatAdmins_AllMembersAreAdmins: String { return self._s[392]! } + public var Message_Sticker: String { return self._s[393]! } + public var LastSeen_JustNow: String { return self._s[395]! } + public var Passport_Email_EmailPlaceholder: String { return self._s[397]! } + public var Channel_AdminLogFilter_EventsEditedMessages: String { return self._s[398]! } + public var Channel_EditAdmin_PermissionsHeader: String { return self._s[399]! } + public var TwoStepAuth_Email: String { return self._s[400]! } + public var PhotoEditor_BlurToolOff: String { return self._s[401]! } + public var Message_PinnedStickerMessage: String { return self._s[402]! } + public var ContactInfo_PhoneLabelPager: String { return self._s[403]! } + public var Passport_DiscardMessageTitle: String { return self._s[404]! } + public var Privacy_PaymentsTitle: String { return self._s[405]! } public func MESSAGE_FWDS(_ _1: String, _ _2: String) -> (String, [(Int, NSRange)]) { - return formatWithArgumentRanges(self._s[409]!, self._r[409]!, [_1, _2]) + return formatWithArgumentRanges(self._s[407]!, self._r[407]!, [_1, _2]) } - public var Appearance_ColorTheme: String { return self._s[410]! } - public var UserInfo_ShareContact: String { return self._s[411]! } - public var Watch_Message_Call: String { return self._s[412]! } - public var Common_More: String { return self._s[413]! } - public var Passport_Address_TypePassportRegistration: String { return self._s[414]! } - public var Profile_EncryptionKey: String { return self._s[417]! } - public var Privacy_TopPeers: String { return self._s[418]! } + public var Appearance_ColorTheme: String { return self._s[408]! } + public var UserInfo_ShareContact: String { return self._s[409]! } + public var Watch_Message_Call: String { return self._s[410]! } + public var Common_More: String { return self._s[411]! } + public var Passport_Address_TypePassportRegistration: String { return self._s[412]! } + public var Profile_EncryptionKey: String { return self._s[415]! } + public var Privacy_TopPeers: String { return self._s[416]! } public func CHANNEL_MESSAGE_TEXT(_ _1: String, _ _2: String) -> (String, [(Int, NSRange)]) { - return formatWithArgumentRanges(self._s[419]!, self._r[419]!, [_1, _2]) + return formatWithArgumentRanges(self._s[417]!, self._r[417]!, [_1, _2]) } - public var Privacy_TopPeersWarning: String { return self._s[421]! } - public var DialogList_SearchSectionMessages: String { return self._s[424]! } - public var Notifications_ChannelNotifications: String { return self._s[425]! } - public var CheckoutInfo_ShippingInfoAddress1Placeholder: String { return self._s[426]! } - public var Passport_Language_sk: String { return self._s[427]! } - public var Notification_MessageLifetime1h: String { return self._s[428]! } - public var Call_ReportSkip: String { return self._s[430]! } - public var Group_ErrorAddTooMuchAdmins: String { return self._s[431]! } - public var Map_Hybrid: String { return self._s[432]! } - public var ChatSettings_AutoDownloadVideos: String { return self._s[435]! } - public var Channel_BanUser_PermissionEmbedLinks: String { return self._s[436]! } - public var InfoPlist_NSLocationAlwaysAndWhenInUseUsageDescription: String { return self._s[437]! } - public var SocksProxySetup_ProxyTelegram: String { return self._s[440]! } - public var Channel_Username_CreatePrivateLinkHelp: String { return self._s[442]! } - public var Conversation_LiveLocationYou: String { return self._s[443]! } - public var UserInfo_ShareBot: String { return self._s[446]! } - public var PhotoEditor_ShadowsTint: String { return self._s[447]! } - public var Message_Audio: String { return self._s[448]! } - public var Passport_Language_lt: String { return self._s[449]! } + public var Privacy_TopPeersWarning: String { return self._s[419]! } + public var DialogList_SearchSectionMessages: String { return self._s[422]! } + public var Notifications_ChannelNotifications: String { return self._s[423]! } + public var CheckoutInfo_ShippingInfoAddress1Placeholder: String { return self._s[424]! } + public var Passport_Language_sk: String { return self._s[425]! } + public var Notification_MessageLifetime1h: String { return self._s[426]! } + public var Call_ReportSkip: String { return self._s[428]! } + public var Group_ErrorAddTooMuchAdmins: String { return self._s[429]! } + public var Map_Hybrid: String { return self._s[430]! } + public var ChatSettings_AutoDownloadVideos: String { return self._s[433]! } + public var Channel_BanUser_PermissionEmbedLinks: String { return self._s[434]! } + public var InfoPlist_NSLocationAlwaysAndWhenInUseUsageDescription: String { return self._s[435]! } + public var SocksProxySetup_ProxyTelegram: String { return self._s[438]! } + public var Channel_Username_CreatePrivateLinkHelp: String { return self._s[440]! } + public var Conversation_LiveLocationYou: String { return self._s[441]! } + public var UserInfo_ShareBot: String { return self._s[444]! } + public var PhotoEditor_ShadowsTint: String { return self._s[445]! } + public var Message_Audio: String { return self._s[446]! } + public var Passport_Language_lt: String { return self._s[447]! } public func Message_PinnedTextMessage(_ _0: String) -> (String, [(Int, NSRange)]) { - return formatWithArgumentRanges(self._s[450]!, self._r[450]!, [_0]) + return formatWithArgumentRanges(self._s[448]!, self._r[448]!, [_0]) } - public var Conversation_FileICloudDrive: String { return self._s[451]! } - public var Notifications_Badge_IncludeMutedChats: String { return self._s[452]! } + public var Permissions_SiriText_v0: String { return self._s[449]! } + public var Conversation_FileICloudDrive: String { return self._s[450]! } + public var Notifications_Badge_IncludeMutedChats: String { return self._s[451]! } public func Notification_NewAuthDetected(_ _1: String, _ _2: String, _ _3: String, _ _4: String, _ _5: String, _ _6: String) -> (String, [(Int, NSRange)]) { - return formatWithArgumentRanges(self._s[453]!, self._r[453]!, [_1, _2, _3, _4, _5, _6]) + return formatWithArgumentRanges(self._s[452]!, self._r[452]!, [_1, _2, _3, _4, _5, _6]) } - public var DialogList_ProxyConnectionIssuesTooltip: String { return self._s[454]! } + public var DialogList_ProxyConnectionIssuesTooltip: String { return self._s[453]! } public func Time_MonthOfYear_m5(_ _0: String) -> (String, [(Int, NSRange)]) { - return formatWithArgumentRanges(self._s[455]!, self._r[455]!, [_0]) + return formatWithArgumentRanges(self._s[454]!, self._r[454]!, [_0]) } - public var Channel_SignMessages: String { return self._s[456]! } - public var Compose_ChannelTokenListPlaceholder: String { return self._s[457]! } - public var Passport_ScanPassport: String { return self._s[458]! } - public var Watch_Message_Invoice: String { return self._s[459]! } - public var Watch_Suggestion_Thanks: String { return self._s[460]! } - public var BlockedUsers_AddNew: String { return self._s[461]! } - public var Month_GenJuly: String { return self._s[462]! } - public var SocksProxySetup_ProxySocks5: String { return self._s[463]! } + public var Channel_SignMessages: String { return self._s[455]! } + public var Compose_ChannelTokenListPlaceholder: String { return self._s[456]! } + public var Passport_ScanPassport: String { return self._s[457]! } + public var Watch_Message_Invoice: String { return self._s[458]! } + public var Watch_Suggestion_Thanks: String { return self._s[459]! } + public var BlockedUsers_AddNew: String { return self._s[460]! } + public var Month_GenJuly: String { return self._s[461]! } + public var SocksProxySetup_ProxySocks5: String { return self._s[462]! } public func CHAT_MESSAGE_PHOTO(_ _1: String, _ _2: String) -> (String, [(Int, NSRange)]) { - return formatWithArgumentRanges(self._s[464]!, self._r[464]!, [_1, _2]) + return formatWithArgumentRanges(self._s[463]!, self._r[463]!, [_1, _2]) } - public var Notification_ChannelInviterSelf: String { return self._s[466]! } - public var CheckoutInfo_ReceiverInfoEmail: String { return self._s[467]! } + public var Notification_ChannelInviterSelf: String { return self._s[465]! } + public var CheckoutInfo_ReceiverInfoEmail: String { return self._s[466]! } public func ApplyLanguage_ChangeLanguageUnofficialText(_ _1: String, _ _2: String) -> (String, [(Int, NSRange)]) { - return formatWithArgumentRanges(self._s[468]!, self._r[468]!, [_1, _2]) + return formatWithArgumentRanges(self._s[467]!, self._r[467]!, [_1, _2]) } - public var CheckoutInfo_Title: String { return self._s[469]! } - public var Watch_Stickers_RecentPlaceholder: String { return self._s[470]! } + public var CheckoutInfo_Title: String { return self._s[468]! } + public var Watch_Stickers_RecentPlaceholder: String { return self._s[469]! } public func Map_DistanceAway(_ _0: String) -> (String, [(Int, NSRange)]) { - return formatWithArgumentRanges(self._s[471]!, self._r[471]!, [_0]) + return formatWithArgumentRanges(self._s[470]!, self._r[470]!, [_0]) } - public var TwoStepAuth_ConfirmEmailResendCode: String { return self._s[472]! } - public var Passport_Identity_MainPage: String { return self._s[473]! } - public var Passport_Language_de: String { return self._s[474]! } - public var Update_Title: String { return self._s[475]! } - public var ContactInfo_PhoneLabelWorkFax: String { return self._s[476]! } - public var Channel_AdminLog_BanEmbedLinks: String { return self._s[477]! } - public var Passport_Email_UseTelegramEmailHelp: String { return self._s[478]! } - public var Notifications_ChannelNotificationsPreview: String { return self._s[479]! } - public var NotificationsSound_Telegraph: String { return self._s[480]! } - public var Watch_LastSeen_ALongTimeAgo: String { return self._s[481]! } - public var ChannelMembers_WhoCanAddMembers: String { return self._s[482]! } + public var TwoStepAuth_ConfirmEmailResendCode: String { return self._s[471]! } + public var Passport_Identity_MainPage: String { return self._s[472]! } + public var Passport_Language_de: String { return self._s[473]! } + public var Update_Title: String { return self._s[474]! } + public var ContactInfo_PhoneLabelWorkFax: String { return self._s[475]! } + public var Channel_AdminLog_BanEmbedLinks: String { return self._s[476]! } + public var Passport_Email_UseTelegramEmailHelp: String { return self._s[477]! } + public var Notifications_ChannelNotificationsPreview: String { return self._s[478]! } + public var NotificationsSound_Telegraph: String { return self._s[479]! } + public var Watch_LastSeen_ALongTimeAgo: String { return self._s[480]! } + public var ChannelMembers_WhoCanAddMembers: String { return self._s[481]! } public func AutoDownloadSettings_UpTo(_ _0: String) -> (String, [(Int, NSRange)]) { - return formatWithArgumentRanges(self._s[483]!, self._r[483]!, [_0]) + return formatWithArgumentRanges(self._s[482]!, self._r[482]!, [_0]) } - public var Stickers_SuggestAll: String { return self._s[484]! } - public var Conversation_ForwardTitle: String { return self._s[485]! } + public var Stickers_SuggestAll: String { return self._s[483]! } + public var Conversation_ForwardTitle: String { return self._s[484]! } public func Notification_JoinedChannel(_ _0: String) -> (String, [(Int, NSRange)]) { - return formatWithArgumentRanges(self._s[486]!, self._r[486]!, [_0]) + return formatWithArgumentRanges(self._s[485]!, self._r[485]!, [_0]) } - public var Calls_NewCall: String { return self._s[487]! } - public var Call_StatusEnded: String { return self._s[488]! } - public var Settings_ProxyConnected: String { return self._s[489]! } - public var Channel_AdminLogFilter_EventsPinned: String { return self._s[490]! } - public var PhotoEditor_QualityVeryLow: String { return self._s[491]! } - public var Channel_AdminLogFilter_EventsDeletedMessages: String { return self._s[492]! } - public var Passport_PasswordPlaceholder: String { return self._s[493]! } - public var Message_PinnedInvoice: String { return self._s[494]! } - public var Passport_Identity_IssueDate: String { return self._s[495]! } - public var Passport_Language_pl: String { return self._s[496]! } + public var Calls_NewCall: String { return self._s[486]! } + public var Call_StatusEnded: String { return self._s[487]! } + public var Settings_ProxyConnected: String { return self._s[488]! } + public var Channel_AdminLogFilter_EventsPinned: String { return self._s[489]! } + public var PhotoEditor_QualityVeryLow: String { return self._s[490]! } + public var Channel_AdminLogFilter_EventsDeletedMessages: String { return self._s[491]! } + public var Passport_PasswordPlaceholder: String { return self._s[492]! } + public var Message_PinnedInvoice: String { return self._s[493]! } + public var Passport_Identity_IssueDate: String { return self._s[494]! } + public var Passport_Language_pl: String { return self._s[495]! } public func ChannelInfo_ChannelForbidden(_ _0: String) -> (String, [(Int, NSRange)]) { - return formatWithArgumentRanges(self._s[497]!, self._r[497]!, [_0]) + return formatWithArgumentRanges(self._s[496]!, self._r[496]!, [_0]) } - public var SocksProxySetup_PasteFromClipboard: String { return self._s[498]! } - public var Call_StatusConnecting: String { return self._s[499]! } + public var SocksProxySetup_PasteFromClipboard: String { return self._s[497]! } + public var Call_StatusConnecting: String { return self._s[498]! } public func Username_UsernameIsAvailable(_ _0: String) -> (String, [(Int, NSRange)]) { - return formatWithArgumentRanges(self._s[500]!, self._r[500]!, [_0]) + return formatWithArgumentRanges(self._s[499]!, self._r[499]!, [_0]) } - public var ChatSettings_ConnectionType_UseProxy: String { return self._s[502]! } - public var Common_Edit: String { return self._s[503]! } - public var PrivacySettings_LastSeenNobody: String { return self._s[504]! } + public var ChatSettings_ConnectionType_UseProxy: String { return self._s[501]! } + public var Common_Edit: String { return self._s[502]! } + public var PrivacySettings_LastSeenNobody: String { return self._s[503]! } public func Notification_LeftChat(_ _0: String) -> (String, [(Int, NSRange)]) { - return formatWithArgumentRanges(self._s[505]!, self._r[505]!, [_0]) + return formatWithArgumentRanges(self._s[504]!, self._r[504]!, [_0]) } - public var GroupInfo_ChatAdmins: String { return self._s[506]! } - public var PrivateDataSettings_Title: String { return self._s[507]! } - public var ChatList_Read: String { return self._s[508]! } - public var Login_CancelPhoneVerificationStop: String { return self._s[509]! } - public var Checkout_ErrorPaymentFailed: String { return self._s[511]! } - public var Update_UpdateApp: String { return self._s[512]! } - public var Group_Username_RevokeExistingUsernamesInfo: String { return self._s[513]! } - public var Settings_Appearance: String { return self._s[514]! } - public var Watch_Location_Access: String { return self._s[515]! } - public var ShareMenu_CopyShareLink: String { return self._s[517]! } - public var TwoStepAuth_SetupHintTitle: String { return self._s[518]! } + public var GroupInfo_ChatAdmins: String { return self._s[505]! } + public var PrivateDataSettings_Title: String { return self._s[506]! } + public var ChatList_Read: String { return self._s[507]! } + public var Login_CancelPhoneVerificationStop: String { return self._s[508]! } + public var Checkout_ErrorPaymentFailed: String { return self._s[510]! } + public var Update_UpdateApp: String { return self._s[511]! } + public var Group_Username_RevokeExistingUsernamesInfo: String { return self._s[512]! } + public var Settings_Appearance: String { return self._s[513]! } + public var Watch_Location_Access: String { return self._s[514]! } + public var ShareMenu_CopyShareLink: String { return self._s[516]! } + public var TwoStepAuth_SetupHintTitle: String { return self._s[517]! } public func PHONE_CALL_MISSED(_ _1: String) -> (String, [(Int, NSRange)]) { - return formatWithArgumentRanges(self._s[520]!, self._r[520]!, [_1]) + return formatWithArgumentRanges(self._s[519]!, self._r[519]!, [_1]) } public func CHAT_MESSAGE_PHOTOS(_ _1: String, _ _2: String, _ _3: String) -> (String, [(Int, NSRange)]) { - return formatWithArgumentRanges(self._s[521]!, self._r[521]!, [_1, _2, _3]) + return formatWithArgumentRanges(self._s[520]!, self._r[520]!, [_1, _2, _3]) } public func DialogList_SingleRecordingVideoMessageSuffix(_ _0: String) -> (String, [(Int, NSRange)]) { - return formatWithArgumentRanges(self._s[522]!, self._r[522]!, [_0]) + return formatWithArgumentRanges(self._s[521]!, self._r[521]!, [_0]) } - public var Notifications_ClassicTones: String { return self._s[523]! } - public var Weekday_ShortWednesday: String { return self._s[524]! } - public var Conversation_LinkDialogCopy: String { return self._s[527]! } - public var KeyCommand_FocusOnInputField: String { return self._s[528]! } - public var Contacts_SelectAll: String { return self._s[529]! } - public var Preview_SaveToCameraRoll: String { return self._s[530]! } + public var Notifications_ClassicTones: String { return self._s[522]! } + public var Weekday_ShortWednesday: String { return self._s[523]! } + public var Conversation_LinkDialogCopy: String { return self._s[526]! } + public var KeyCommand_FocusOnInputField: String { return self._s[527]! } + public var Contacts_SelectAll: String { return self._s[528]! } + public var Preview_SaveToCameraRoll: String { return self._s[529]! } public func CHANNEL_MESSAGE_GAME(_ _1: String, _ _2: String) -> (String, [(Int, NSRange)]) { - return formatWithArgumentRanges(self._s[531]!, self._r[531]!, [_1, _2]) + return formatWithArgumentRanges(self._s[530]!, self._r[530]!, [_1, _2]) } - public var Wallpaper_Title: String { return self._s[532]! } - public var Conversation_FilePhotoOrVideo: String { return self._s[533]! } - public var AccessDenied_Camera: String { return self._s[534]! } - public var Watch_Compose_CurrentLocation: String { return self._s[535]! } + public var Wallpaper_Title: String { return self._s[531]! } + public var Conversation_FilePhotoOrVideo: String { return self._s[532]! } + public var AccessDenied_Camera: String { return self._s[533]! } + public var Watch_Compose_CurrentLocation: String { return self._s[534]! } public func SecretImage_NotViewedYet(_ _0: String) -> (String, [(Int, NSRange)]) { - return formatWithArgumentRanges(self._s[537]!, self._r[537]!, [_0]) + return formatWithArgumentRanges(self._s[536]!, self._r[536]!, [_0]) } - public var GroupInfo_InvitationLinkDoesNotExist: String { return self._s[538]! } - public var Passport_Language_ro: String { return self._s[539]! } - public var CheckoutInfo_SaveInfoHelp: String { return self._s[540]! } + public var GroupInfo_InvitationLinkDoesNotExist: String { return self._s[537]! } + public var Passport_Language_ro: String { return self._s[538]! } + public var CheckoutInfo_SaveInfoHelp: String { return self._s[539]! } public func Notification_SecretChatMessageScreenshot(_ _0: String) -> (String, [(Int, NSRange)]) { - return formatWithArgumentRanges(self._s[541]!, self._r[541]!, [_0]) + return formatWithArgumentRanges(self._s[540]!, self._r[540]!, [_0]) } - public var Login_CancelPhoneVerification: String { return self._s[542]! } - public var State_ConnectingToProxy: String { return self._s[543]! } - public var Calls_RatingTitle: String { return self._s[544]! } - public var Generic_ErrorMoreInfo: String { return self._s[545]! } - public var Appearance_PreviewReplyText: String { return self._s[546]! } - public var CheckoutInfo_ShippingInfoPostcodePlaceholder: String { return self._s[547]! } - public var SharedMedia_CategoryLinks: String { return self._s[548]! } - public var Calls_Missed: String { return self._s[549]! } - public var Cache_Photos: String { return self._s[553]! } + public var Login_CancelPhoneVerification: String { return self._s[541]! } + public var State_ConnectingToProxy: String { return self._s[542]! } + public var Calls_RatingTitle: String { return self._s[543]! } + public var Generic_ErrorMoreInfo: String { return self._s[544]! } + public var Appearance_PreviewReplyText: String { return self._s[545]! } + public var CheckoutInfo_ShippingInfoPostcodePlaceholder: String { return self._s[546]! } + public var SharedMedia_CategoryLinks: String { return self._s[547]! } + public var Calls_Missed: String { return self._s[548]! } + public var Cache_Photos: String { return self._s[552]! } public func Channel_AdminLog_MessageUnpinned(_ _0: String) -> (String, [(Int, NSRange)]) { - return formatWithArgumentRanges(self._s[554]!, self._r[554]!, [_0]) + return formatWithArgumentRanges(self._s[553]!, self._r[553]!, [_0]) } - public var Conversation_ShareBotLocationConfirmationTitle: String { return self._s[555]! } - public var Settings_ProxyDisabled: String { return self._s[556]! } + public var Conversation_ShareBotLocationConfirmationTitle: String { return self._s[554]! } + public var Settings_ProxyDisabled: String { return self._s[555]! } public func Settings_ApplyProxyAlertCredentials(_ _1: String, _ _2: String, _ _3: String, _ _4: String) -> (String, [(Int, NSRange)]) { - return formatWithArgumentRanges(self._s[557]!, self._r[557]!, [_1, _2, _3, _4]) + return formatWithArgumentRanges(self._s[556]!, self._r[556]!, [_1, _2, _3, _4]) } public func Conversation_RestrictedMediaTimed(_ _0: String) -> (String, [(Int, NSRange)]) { - return formatWithArgumentRanges(self._s[558]!, self._r[558]!, [_0]) + return formatWithArgumentRanges(self._s[557]!, self._r[557]!, [_0]) } - public var Appearance_Title: String { return self._s[559]! } + public var Appearance_Title: String { return self._s[558]! } public func Time_MonthOfYear_m2(_ _0: String) -> (String, [(Int, NSRange)]) { - return formatWithArgumentRanges(self._s[561]!, self._r[561]!, [_0]) + return formatWithArgumentRanges(self._s[560]!, self._r[560]!, [_0]) } public func CHANNEL_MESSAGE_DOC(_ _1: String) -> (String, [(Int, NSRange)]) { - return formatWithArgumentRanges(self._s[562]!, self._r[562]!, [_1]) + return formatWithArgumentRanges(self._s[561]!, self._r[561]!, [_1]) } public func PINNED_DOC(_ _1: String) -> (String, [(Int, NSRange)]) { - return formatWithArgumentRanges(self._s[563]!, self._r[563]!, [_1]) + return formatWithArgumentRanges(self._s[562]!, self._r[562]!, [_1]) } - public var StickerPacksSettings_ShowStickersButtonHelp: String { return self._s[564]! } - public var Channel_EditMessageErrorGeneric: String { return self._s[565]! } - public var Privacy_Calls_IntegrationHelp: String { return self._s[566]! } - public var Preview_DeletePhoto: String { return self._s[567]! } - public var PrivacySettings_PrivacyTitle: String { return self._s[568]! } + public var StickerPacksSettings_ShowStickersButtonHelp: String { return self._s[563]! } + public var Channel_EditMessageErrorGeneric: String { return self._s[564]! } + public var Privacy_Calls_IntegrationHelp: String { return self._s[565]! } + public var Preview_DeletePhoto: String { return self._s[566]! } + public var PrivacySettings_PrivacyTitle: String { return self._s[567]! } public func Conversation_BotInteractiveUrlAlert(_ _0: String) -> (String, [(Int, NSRange)]) { - return formatWithArgumentRanges(self._s[569]!, self._r[569]!, [_0]) + return formatWithArgumentRanges(self._s[568]!, self._r[568]!, [_0]) } - public var Coub_TapForSound: String { return self._s[571]! } - public var Map_LocatingError: String { return self._s[572]! } + public var Coub_TapForSound: String { return self._s[570]! } + public var Map_LocatingError: String { return self._s[571]! } public func CHAT_MESSAGE_TEXT(_ _1: String, _ _2: String, _ _3: String) -> (String, [(Int, NSRange)]) { - return formatWithArgumentRanges(self._s[574]!, self._r[574]!, [_1, _2, _3]) + return formatWithArgumentRanges(self._s[573]!, self._r[573]!, [_1, _2, _3]) } - public var TwoStepAuth_EmailChangeSuccess: String { return self._s[575]! } - public var Passport_ForgottenPassword: String { return self._s[576]! } - public var GroupInfo_InviteLink_RevokeLink: String { return self._s[577]! } - public var StickerPacksSettings_ArchivedPacks: String { return self._s[578]! } + public var TwoStepAuth_EmailChangeSuccess: String { return self._s[574]! } + public var Passport_ForgottenPassword: String { return self._s[575]! } + public var GroupInfo_InviteLink_RevokeLink: String { return self._s[576]! } + public var StickerPacksSettings_ArchivedPacks: String { return self._s[577]! } public func PINNED_STICKER(_ _1: String, _ _2: String) -> (String, [(Int, NSRange)]) { - return formatWithArgumentRanges(self._s[580]!, self._r[580]!, [_1, _2]) + return formatWithArgumentRanges(self._s[579]!, self._r[579]!, [_1, _2]) } - public var Login_TermsOfServiceSignupDecline: String { return self._s[581]! } - public var Channel_Moderator_AccessLevelRevoke: String { return self._s[582]! } - public var Message_Location: String { return self._s[583]! } - public var Passport_Identity_NamePlaceholder: String { return self._s[584]! } - public var Channel_Management_Title: String { return self._s[585]! } - public var DialogList_SearchSectionDialogs: String { return self._s[587]! } - public var Compose_NewChannel_Members: String { return self._s[588]! } + public var Login_TermsOfServiceSignupDecline: String { return self._s[580]! } + public var Channel_Moderator_AccessLevelRevoke: String { return self._s[581]! } + public var Message_Location: String { return self._s[582]! } + public var Passport_Identity_NamePlaceholder: String { return self._s[583]! } + public var Channel_Management_Title: String { return self._s[584]! } + public var DialogList_SearchSectionDialogs: String { return self._s[586]! } + public var Compose_NewChannel_Members: String { return self._s[587]! } public func DialogList_SingleUploadingFileSuffix(_ _0: String) -> (String, [(Int, NSRange)]) { - return formatWithArgumentRanges(self._s[589]!, self._r[589]!, [_0]) + return formatWithArgumentRanges(self._s[588]!, self._r[588]!, [_0]) } - public var AutoNightTheme_ScheduledFrom: String { return self._s[590]! } - public var PhotoEditor_WarmthTool: String { return self._s[591]! } - public var Passport_Language_tr: String { return self._s[592]! } - public var Login_ResetAccountProtected_Reset: String { return self._s[594]! } - public var Watch_PhotoView_Title: String { return self._s[595]! } + public var AutoNightTheme_ScheduledFrom: String { return self._s[589]! } + public var PhotoEditor_WarmthTool: String { return self._s[590]! } + public var Passport_Language_tr: String { return self._s[591]! } + public var Login_ResetAccountProtected_Reset: String { return self._s[593]! } + public var Watch_PhotoView_Title: String { return self._s[594]! } public func MESSAGES(_ _1: String, _ _2: String) -> (String, [(Int, NSRange)]) { - return formatWithArgumentRanges(self._s[596]!, self._r[596]!, [_1, _2]) + return formatWithArgumentRanges(self._s[595]!, self._r[595]!, [_1, _2]) } - public var Passport_Phone_Delete: String { return self._s[597]! } - public var Conversation_EditingMessageMediaEditCurrentPhoto: String { return self._s[598]! } - public var PasscodeSettings_TurnPasscodeOff: String { return self._s[599]! } - public var Profile_ShareContactButton: String { return self._s[600]! } - public var ChatSettings_Other: String { return self._s[601]! } - public var UserInfo_NotificationsDisabled: String { return self._s[602]! } - public var CheckoutInfo_ShippingInfoCity: String { return self._s[603]! } - public var LastSeen_WithinAMonth: String { return self._s[604]! } - public var Channel_AdminLog_BanSendStickers: String { return self._s[605]! } - public var Conversation_EncryptionCanceled: String { return self._s[606]! } - public var MediaPicker_GroupDescription: String { return self._s[607]! } - public var WebSearch_Images: String { return self._s[608]! } + public var Passport_Phone_Delete: String { return self._s[596]! } + public var Conversation_EditingMessageMediaEditCurrentPhoto: String { return self._s[597]! } + public var PasscodeSettings_TurnPasscodeOff: String { return self._s[598]! } + public var Profile_ShareContactButton: String { return self._s[599]! } + public var ChatSettings_Other: String { return self._s[600]! } + public var UserInfo_NotificationsDisabled: String { return self._s[601]! } + public var CheckoutInfo_ShippingInfoCity: String { return self._s[602]! } + public var LastSeen_WithinAMonth: String { return self._s[603]! } + public var Channel_AdminLog_BanSendStickers: String { return self._s[604]! } + public var Conversation_EncryptionCanceled: String { return self._s[605]! } + public var MediaPicker_GroupDescription: String { return self._s[606]! } + public var WebSearch_Images: String { return self._s[607]! } public func Channel_Management_PromotedBy(_ _0: String) -> (String, [(Int, NSRange)]) { - return formatWithArgumentRanges(self._s[609]!, self._r[609]!, [_0]) + return formatWithArgumentRanges(self._s[608]!, self._r[608]!, [_0]) } - public var Message_Photo: String { return self._s[610]! } - public var PasscodeSettings_HelpBottom: String { return self._s[611]! } - public var AutoDownloadSettings_VideosTitle: String { return self._s[612]! } - public var Passport_Identity_AddDriversLicense: String { return self._s[613]! } - public var TwoStepAuth_EnterPasswordPassword: String { return self._s[614]! } - public var NotificationsSound_Calypso: String { return self._s[615]! } - public var Map_Map: String { return self._s[616]! } - public var CheckoutInfo_ReceiverInfoTitle: String { return self._s[618]! } - public var ChatSettings_TextSizeUnits: String { return self._s[619]! } - public var Common_of: String { return self._s[620]! } - public var Conversation_ForwardContacts: String { return self._s[622]! } - public var Passport_Language_hy: String { return self._s[623]! } - public var Notifications_MessageNotificationsHelp: String { return self._s[624]! } - public var AutoDownloadSettings_Reset: String { return self._s[625]! } - public var Permissions_CellularDataText: String { return self._s[626]! } - public var Paint_ClearConfirm: String { return self._s[627]! } - public var Camera_VideoMode: String { return self._s[628]! } + public var Message_Photo: String { return self._s[609]! } + public var PasscodeSettings_HelpBottom: String { return self._s[610]! } + public var AutoDownloadSettings_VideosTitle: String { return self._s[611]! } + public var Passport_Identity_AddDriversLicense: String { return self._s[612]! } + public var TwoStepAuth_EnterPasswordPassword: String { return self._s[613]! } + public var NotificationsSound_Calypso: String { return self._s[614]! } + public var Map_Map: String { return self._s[615]! } + public var CheckoutInfo_ReceiverInfoTitle: String { return self._s[617]! } + public var ChatSettings_TextSizeUnits: String { return self._s[618]! } + public var Common_of: String { return self._s[619]! } + public var Conversation_ForwardContacts: String { return self._s[621]! } + public var Passport_Language_hy: String { return self._s[622]! } + public var Notifications_MessageNotificationsHelp: String { return self._s[623]! } + public var AutoDownloadSettings_Reset: String { return self._s[624]! } + public var Paint_ClearConfirm: String { return self._s[625]! } + public var Camera_VideoMode: String { return self._s[626]! } public func MESSAGE_NOTEXT(_ _1: String) -> (String, [(Int, NSRange)]) { - return formatWithArgumentRanges(self._s[629]!, self._r[629]!, [_1]) + return formatWithArgumentRanges(self._s[627]!, self._r[627]!, [_1]) } - public var Privacy_Calls_AlwaysAllow_Placeholder: String { return self._s[630]! } + public var Privacy_Calls_AlwaysAllow_Placeholder: String { return self._s[628]! } public func Conversation_RestrictedStickersTimed(_ _0: String) -> (String, [(Int, NSRange)]) { - return formatWithArgumentRanges(self._s[631]!, self._r[631]!, [_0]) + return formatWithArgumentRanges(self._s[629]!, self._r[629]!, [_0]) } - public var Passport_Language_el: String { return self._s[632]! } - public var PhotoEditor_Original: String { return self._s[633]! } - public var Settings_FAQ_Button: String { return self._s[634]! } - public var Channel_Setup_PublicNoLink: String { return self._s[636]! } - public var Conversation_UnsupportedMedia: String { return self._s[637]! } - public var Conversation_SlideToCancel: String { return self._s[638]! } - public var Passport_Identity_OneOfTypeInternalPassport: String { return self._s[639]! } - public var CheckoutInfo_ShippingInfoPostcode: String { return self._s[640]! } - public var AutoNightTheme_NotAvailable: String { return self._s[641]! } - public var Common_Create: String { return self._s[642]! } - public var Settings_ApplyProxyAlertEnable: String { return self._s[643]! } - public var Localization_ChooseLanguage: String { return self._s[645]! } - public var Settings_Proxy: String { return self._s[648]! } - public var Privacy_TopPeersHelp: String { return self._s[649]! } - public var CheckoutInfo_ShippingInfoCountryPlaceholder: String { return self._s[650]! } - public var TwoStepAuth_ConfirmationAbort: String { return self._s[651]! } + public var Passport_Language_el: String { return self._s[630]! } + public var PhotoEditor_Original: String { return self._s[631]! } + public var Settings_FAQ_Button: String { return self._s[632]! } + public var Channel_Setup_PublicNoLink: String { return self._s[634]! } + public var Conversation_UnsupportedMedia: String { return self._s[635]! } + public var Conversation_SlideToCancel: String { return self._s[636]! } + public var Passport_Identity_OneOfTypeInternalPassport: String { return self._s[637]! } + public var CheckoutInfo_ShippingInfoPostcode: String { return self._s[638]! } + public var AutoNightTheme_NotAvailable: String { return self._s[639]! } + public var Common_Create: String { return self._s[640]! } + public var Settings_ApplyProxyAlertEnable: String { return self._s[641]! } + public var Localization_ChooseLanguage: String { return self._s[643]! } + public var Settings_Proxy: String { return self._s[646]! } + public var Privacy_TopPeersHelp: String { return self._s[647]! } + public var CheckoutInfo_ShippingInfoCountryPlaceholder: String { return self._s[648]! } + public var TwoStepAuth_ConfirmationAbort: String { return self._s[649]! } public func Contacts_AccessDeniedHelpPortrait(_ _0: String) -> (String, [(Int, NSRange)]) { - return formatWithArgumentRanges(self._s[653]!, self._r[653]!, [_0]) + return formatWithArgumentRanges(self._s[651]!, self._r[651]!, [_0]) } - public var Passport_Identity_SurnamePlaceholder: String { return self._s[654]! } - public var Cache_Title: String { return self._s[655]! } - public var TwoStepAuth_EmailCodeExpired: String { return self._s[656]! } - public var Channel_Moderator_Title: String { return self._s[657]! } - public var InstantPage_AutoNightTheme: String { return self._s[659]! } - public var Passport_Scans_Upload: String { return self._s[663]! } - public var Contacts_AccessDeniedHelpON: String { return self._s[664]! } - public var TwoStepAuth_RemovePassword: String { return self._s[665]! } - public var Common_Delete: String { return self._s[666]! } - public var Conversation_ContextMenuDelete: String { return self._s[668]! } - public var SocksProxySetup_Credentials: String { return self._s[669]! } - public var PasscodeSettings_AutoLock_Disabled: String { return self._s[671]! } - public var Passport_Address_OneOfTypeRentalAgreement: String { return self._s[674]! } - public var Conversation_ShareBotContactConfirmationTitle: String { return self._s[675]! } - public var Passport_Language_id: String { return self._s[677]! } - public var ChannelIntro_Title: String { return self._s[678]! } + public var Passport_Identity_SurnamePlaceholder: String { return self._s[652]! } + public var Cache_Title: String { return self._s[653]! } + public var TwoStepAuth_EmailCodeExpired: String { return self._s[654]! } + public var Channel_Moderator_Title: String { return self._s[655]! } + public var InstantPage_AutoNightTheme: String { return self._s[657]! } + public var Passport_Scans_Upload: String { return self._s[661]! } + public var Contacts_AccessDeniedHelpON: String { return self._s[662]! } + public var TwoStepAuth_RemovePassword: String { return self._s[663]! } + public var Common_Delete: String { return self._s[664]! } + public var Conversation_ContextMenuDelete: String { return self._s[666]! } + public var SocksProxySetup_Credentials: String { return self._s[667]! } + public var PasscodeSettings_AutoLock_Disabled: String { return self._s[669]! } + public var Passport_Address_OneOfTypeRentalAgreement: String { return self._s[672]! } + public var Conversation_ShareBotContactConfirmationTitle: String { return self._s[673]! } + public var Passport_Language_id: String { return self._s[675]! } + public var ChannelIntro_Title: String { return self._s[676]! } public func Channel_AdminLog_MessageToggleSignaturesOff(_ _0: String) -> (String, [(Int, NSRange)]) { - return formatWithArgumentRanges(self._s[679]!, self._r[679]!, [_0]) + return formatWithArgumentRanges(self._s[677]!, self._r[677]!, [_0]) } public func PINNED_NOTEXT(_ _1: String) -> (String, [(Int, NSRange)]) { - return formatWithArgumentRanges(self._s[681]!, self._r[681]!, [_1]) + return formatWithArgumentRanges(self._s[679]!, self._r[679]!, [_1]) } - public var Channel_Info_Description: String { return self._s[682]! } - public var Stickers_FavoriteStickers: String { return self._s[683]! } - public var Notifications_DisplayNamesOnLockScreen: String { return self._s[684]! } - public var Calls_NoMissedCallsPlacehoder: String { return self._s[685]! } - public var Notifications_ExceptionsDefaultSound: String { return self._s[686]! } + public var Channel_Info_Description: String { return self._s[680]! } + public var Stickers_FavoriteStickers: String { return self._s[681]! } + public var Notifications_DisplayNamesOnLockScreen: String { return self._s[682]! } + public var Calls_NoMissedCallsPlacehoder: String { return self._s[683]! } + public var Notifications_ExceptionsDefaultSound: String { return self._s[684]! } public func DialogList_SearchSubtitleFormat(_ _1: String, _ _2: String) -> (String, [(Int, NSRange)]) { - return formatWithArgumentRanges(self._s[687]!, self._r[687]!, [_1, _2]) + return formatWithArgumentRanges(self._s[685]!, self._r[685]!, [_1, _2]) } public func Channel_AdminLog_MessageRemovedGroupStickerPack(_ _0: String) -> (String, [(Int, NSRange)]) { - return formatWithArgumentRanges(self._s[688]!, self._r[688]!, [_0]) + return formatWithArgumentRanges(self._s[686]!, self._r[686]!, [_0]) } - public var Passport_Language_uk: String { return self._s[689]! } - public var StickerPack_HideStickers: String { return self._s[691]! } - public var ChangePhoneNumberNumber_NumberPlaceholder: String { return self._s[692]! } - public var Activity_UploadingVideoMessage: String { return self._s[693]! } - public var Channel_TitleInfo: String { return self._s[694]! } - public var StickerPacksSettings_ArchivedPacks_Info: String { return self._s[695]! } - public var Settings_CallSettings: String { return self._s[696]! } - public var Camera_SquareMode: String { return self._s[697]! } - public var GroupInfo_SharedMediaNone: String { return self._s[698]! } - public var Bot_GenericBotStatus: String { return self._s[699]! } - public var Application_Update: String { return self._s[701]! } - public var Month_ShortJanuary: String { return self._s[702]! } - public var Channel_AdminLog_BanReadMessages: String { return self._s[703]! } - public var Settings_AppLanguage_Unofficial: String { return self._s[704]! } - public var Passport_Address_Street2Placeholder: String { return self._s[705]! } + public var Passport_Language_uk: String { return self._s[687]! } + public var StickerPack_HideStickers: String { return self._s[689]! } + public var ChangePhoneNumberNumber_NumberPlaceholder: String { return self._s[690]! } + public var Activity_UploadingVideoMessage: String { return self._s[691]! } + public var Channel_TitleInfo: String { return self._s[692]! } + public var StickerPacksSettings_ArchivedPacks_Info: String { return self._s[693]! } + public var Settings_CallSettings: String { return self._s[694]! } + public var Camera_SquareMode: String { return self._s[695]! } + public var GroupInfo_SharedMediaNone: String { return self._s[696]! } + public var Bot_GenericBotStatus: String { return self._s[697]! } + public var Application_Update: String { return self._s[699]! } + public var Month_ShortJanuary: String { return self._s[700]! } + public var Channel_AdminLog_BanReadMessages: String { return self._s[701]! } + public var Settings_AppLanguage_Unofficial: String { return self._s[702]! } + public var Passport_Address_Street2Placeholder: String { return self._s[703]! } public func Map_LiveLocationShortHour(_ _0: String) -> (String, [(Int, NSRange)]) { - return formatWithArgumentRanges(self._s[706]!, self._r[706]!, [_0]) + return formatWithArgumentRanges(self._s[704]!, self._r[704]!, [_0]) } - public var NetworkUsageSettings_Cellular: String { return self._s[707]! } - public var Appearance_PreviewOutgoingText: String { return self._s[708]! } - public var Notifications_PermissionsAllowInSettings: String { return self._s[709]! } - public var Map_Directions: String { return self._s[710]! } - public var Passport_FieldIdentityTranslationHelp: String { return self._s[712]! } - public var Appearance_ThemeDay: String { return self._s[713]! } - public var Passport_Identity_AddPassport: String { return self._s[714]! } - public var Call_Message: String { return self._s[715]! } - public var PhotoEditor_ExposureTool: String { return self._s[716]! } - public var Passport_FieldOneOf_Delimeter: String { return self._s[718]! } - public var Channel_AdminLog_CanBanUsers: String { return self._s[720]! } + public var NetworkUsageSettings_Cellular: String { return self._s[705]! } + public var Appearance_PreviewOutgoingText: String { return self._s[706]! } + public var Notifications_PermissionsAllowInSettings: String { return self._s[707]! } + public var Map_Directions: String { return self._s[708]! } + public var Passport_FieldIdentityTranslationHelp: String { return self._s[710]! } + public var Appearance_ThemeDay: String { return self._s[711]! } + public var Passport_Identity_AddPassport: String { return self._s[712]! } + public var Call_Message: String { return self._s[713]! } + public var PhotoEditor_ExposureTool: String { return self._s[714]! } + public var Passport_FieldOneOf_Delimeter: String { return self._s[716]! } + public var Channel_AdminLog_CanBanUsers: String { return self._s[718]! } public func PINNED_CONTACT(_ _1: String) -> (String, [(Int, NSRange)]) { - return formatWithArgumentRanges(self._s[721]!, self._r[721]!, [_1]) + return formatWithArgumentRanges(self._s[719]!, self._r[719]!, [_1]) } - public var Appearance_Preview: String { return self._s[722]! } - public var Compose_ChannelMembers: String { return self._s[723]! } - public var Conversation_DeleteManyMessages: String { return self._s[724]! } - public var ReportPeer_ReasonOther_Title: String { return self._s[725]! } - public var Checkout_ErrorProviderAccountTimeout: String { return self._s[726]! } - public var TwoStepAuth_ResetAccountConfirmation: String { return self._s[727]! } - public var Channel_Stickers_CreateYourOwn: String { return self._s[729]! } + public var Appearance_Preview: String { return self._s[720]! } + public var Compose_ChannelMembers: String { return self._s[721]! } + public var Conversation_DeleteManyMessages: String { return self._s[722]! } + public var ReportPeer_ReasonOther_Title: String { return self._s[723]! } + public var Checkout_ErrorProviderAccountTimeout: String { return self._s[724]! } + public var TwoStepAuth_ResetAccountConfirmation: String { return self._s[725]! } + public var Channel_Stickers_CreateYourOwn: String { return self._s[727]! } public func Notification_PinnedPhotoMessage(_ _0: String) -> (String, [(Int, NSRange)]) { - return formatWithArgumentRanges(self._s[730]!, self._r[730]!, [_0]) + return formatWithArgumentRanges(self._s[728]!, self._r[728]!, [_0]) } public func MESSAGE_GAME(_ _1: String, _ _2: String) -> (String, [(Int, NSRange)]) { - return formatWithArgumentRanges(self._s[731]!, self._r[731]!, [_1, _2]) + return formatWithArgumentRanges(self._s[729]!, self._r[729]!, [_1, _2]) } public func PrivacySettings_LastSeenNobodyPlus(_ _0: String) -> (String, [(Int, NSRange)]) { - return formatWithArgumentRanges(self._s[732]!, self._r[732]!, [_0]) + return formatWithArgumentRanges(self._s[730]!, self._r[730]!, [_0]) } - public var Tour_Title3: String { return self._s[733]! } - public var Clipboard_SendPhoto: String { return self._s[737]! } - public var MediaPicker_Videos: String { return self._s[738]! } - public var Passport_Email_Title: String { return self._s[739]! } + public var Tour_Title3: String { return self._s[731]! } + public var Clipboard_SendPhoto: String { return self._s[735]! } + public var MediaPicker_Videos: String { return self._s[736]! } + public var Passport_Email_Title: String { return self._s[737]! } public func PrivacySettings_LastSeenEverybodyMinus(_ _0: String) -> (String, [(Int, NSRange)]) { - return formatWithArgumentRanges(self._s[740]!, self._r[740]!, [_0]) + return formatWithArgumentRanges(self._s[738]!, self._r[738]!, [_0]) } - public var StickerPacksSettings_Title: String { return self._s[741]! } - public var Conversation_MessageDialogDelete: String { return self._s[742]! } - public var Privacy_Calls_CustomHelp: String { return self._s[744]! } - public var Core_ServiceUserStatus: String { return self._s[745]! } - public var LiveLocationUpdated_JustNow: String { return self._s[746]! } + public var StickerPacksSettings_Title: String { return self._s[739]! } + public var Conversation_MessageDialogDelete: String { return self._s[740]! } + public var Privacy_Calls_CustomHelp: String { return self._s[742]! } + public var Core_ServiceUserStatus: String { return self._s[743]! } + public var LiveLocationUpdated_JustNow: String { return self._s[744]! } public func CHAT_DELETE_YOU(_ _1: String, _ _2: String) -> (String, [(Int, NSRange)]) { - return formatWithArgumentRanges(self._s[747]!, self._r[747]!, [_1, _2]) + return formatWithArgumentRanges(self._s[745]!, self._r[745]!, [_1, _2]) } - public var Call_StatusFailed: String { return self._s[748]! } - public var TwoStepAuth_SetupPasswordDescription: String { return self._s[749]! } - public var TwoStepAuth_SetPassword: String { return self._s[750]! } + public var Call_StatusFailed: String { return self._s[746]! } + public var TwoStepAuth_SetupPasswordDescription: String { return self._s[747]! } + public var TwoStepAuth_SetPassword: String { return self._s[748]! } public func SocksProxySetup_ProxyStatusPing(_ _0: String) -> (String, [(Int, NSRange)]) { - return formatWithArgumentRanges(self._s[752]!, self._r[752]!, [_0]) + return formatWithArgumentRanges(self._s[750]!, self._r[750]!, [_0]) } - public var Calls_SubmitRating: String { return self._s[753]! } - public var Profile_Username: String { return self._s[754]! } - public var Bot_DescriptionTitle: String { return self._s[755]! } - public var MaskStickerSettings_Title: String { return self._s[756]! } - public var SharedMedia_CategoryOther: String { return self._s[757]! } - public var GroupInfo_SetGroupPhoto: String { return self._s[758]! } - public var Common_NotNow: String { return self._s[759]! } - public var Map_Location: String { return self._s[760]! } - public var Invitation_JoinGroup: String { return self._s[761]! } - public var AutoDownloadSettings_Title: String { return self._s[762]! } - public var Conversation_DiscardVoiceMessageDescription: String { return self._s[763]! } - public var Channel_ErrorAddBlocked: String { return self._s[764]! } - public var Conversation_UnblockUser: String { return self._s[765]! } - public var Watch_Bot_Restart: String { return self._s[766]! } - public var TwoStepAuth_Title: String { return self._s[767]! } - public var Channel_AdminLog_BanSendMessages: String { return self._s[768]! } - public var Checkout_ShippingMethod: String { return self._s[769]! } - public var Passport_Identity_OneOfTypeIdentityCard: String { return self._s[770]! } + public var Calls_SubmitRating: String { return self._s[751]! } + public var Profile_Username: String { return self._s[752]! } + public var Bot_DescriptionTitle: String { return self._s[753]! } + public var MaskStickerSettings_Title: String { return self._s[754]! } + public var SharedMedia_CategoryOther: String { return self._s[755]! } + public var GroupInfo_SetGroupPhoto: String { return self._s[756]! } + public var Common_NotNow: String { return self._s[757]! } + public var Map_Location: String { return self._s[758]! } + public var Invitation_JoinGroup: String { return self._s[759]! } + public var AutoDownloadSettings_Title: String { return self._s[760]! } + public var Conversation_DiscardVoiceMessageDescription: String { return self._s[761]! } + public var Channel_ErrorAddBlocked: String { return self._s[762]! } + public var Conversation_UnblockUser: String { return self._s[763]! } + public var Watch_Bot_Restart: String { return self._s[764]! } + public var TwoStepAuth_Title: String { return self._s[765]! } + public var Channel_AdminLog_BanSendMessages: String { return self._s[766]! } + public var Checkout_ShippingMethod: String { return self._s[767]! } + public var Passport_Identity_OneOfTypeIdentityCard: String { return self._s[768]! } public func Channel_Username_LinkHint(_ _0: String) -> (String, [(Int, NSRange)]) { - return formatWithArgumentRanges(self._s[772]!, self._r[772]!, [_0]) + return formatWithArgumentRanges(self._s[770]!, self._r[770]!, [_0]) } - public var AuthSessions_TerminateOtherSessions: String { return self._s[773]! } - public var Contacts_FailedToSendInvitesMessage: String { return self._s[774]! } - public var PrivacySettings_TwoStepAuth: String { return self._s[775]! } - public var Conversation_EditingMessagePanelMedia: String { return self._s[776]! } - public var Checkout_PaymentMethod_Title: String { return self._s[777]! } - public var SocksProxySetup_Connection: String { return self._s[778]! } - public var Group_MessagePhotoRemoved: String { return self._s[779]! } - public var Channel_Stickers_NotFound: String { return self._s[781]! } - public var Group_About_Help: String { return self._s[782]! } - public var Notification_PassportValueProofOfIdentity: String { return self._s[784]! } + public var AuthSessions_TerminateOtherSessions: String { return self._s[771]! } + public var Contacts_FailedToSendInvitesMessage: String { return self._s[772]! } + public var PrivacySettings_TwoStepAuth: String { return self._s[773]! } + public var Conversation_EditingMessagePanelMedia: String { return self._s[774]! } + public var Checkout_PaymentMethod_Title: String { return self._s[775]! } + public var SocksProxySetup_Connection: String { return self._s[776]! } + public var Group_MessagePhotoRemoved: String { return self._s[777]! } + public var Channel_Stickers_NotFound: String { return self._s[779]! } + public var Group_About_Help: String { return self._s[780]! } + public var Notification_PassportValueProofOfIdentity: String { return self._s[782]! } public func ApplyLanguage_ChangeLanguageOfficialText(_ _1: String) -> (String, [(Int, NSRange)]) { - return formatWithArgumentRanges(self._s[785]!, self._r[785]!, [_1]) + return formatWithArgumentRanges(self._s[783]!, self._r[783]!, [_1]) } - public var CheckoutInfo_ShippingInfoStatePlaceholder: String { return self._s[787]! } - public var Notifications_GroupNotificationsExceptionsHelp: String { return self._s[788]! } - public var SocksProxySetup_Password: String { return self._s[789]! } - public var TwoStepAuth_ChangeEmail: String { return self._s[791]! } + public var CheckoutInfo_ShippingInfoStatePlaceholder: String { return self._s[785]! } + public var Notifications_GroupNotificationsExceptionsHelp: String { return self._s[786]! } + public var SocksProxySetup_Password: String { return self._s[787]! } + public var TwoStepAuth_ChangeEmail: String { return self._s[789]! } public func MESSAGE_TEXT(_ _1: String, _ _2: String) -> (String, [(Int, NSRange)]) { - return formatWithArgumentRanges(self._s[792]!, self._r[792]!, [_1, _2]) + return formatWithArgumentRanges(self._s[790]!, self._r[790]!, [_1, _2]) } public func Channel_AdminLog_MessageInvitedName(_ _1: String) -> (String, [(Int, NSRange)]) { - return formatWithArgumentRanges(self._s[793]!, self._r[793]!, [_1]) + return formatWithArgumentRanges(self._s[791]!, self._r[791]!, [_1]) } public func Time_MonthOfYear_m10(_ _0: String) -> (String, [(Int, NSRange)]) { - return formatWithArgumentRanges(self._s[795]!, self._r[795]!, [_0]) + return formatWithArgumentRanges(self._s[793]!, self._r[793]!, [_0]) } - public var Passport_Identity_TypeDriversLicense: String { return self._s[796]! } - public var ArchivedPacksAlert_Title: String { return self._s[797]! } + public var Passport_Identity_TypeDriversLicense: String { return self._s[794]! } + public var ArchivedPacksAlert_Title: String { return self._s[795]! } public func Time_PreciseDate_m7(_ _1: String, _ _2: String, _ _3: String) -> (String, [(Int, NSRange)]) { - return formatWithArgumentRanges(self._s[798]!, self._r[798]!, [_1, _2, _3]) + return formatWithArgumentRanges(self._s[796]!, self._r[796]!, [_1, _2, _3]) } - public var PrivacyLastSeenSettings_GroupsAndChannelsHelp: String { return self._s[799]! } - public var Privacy_Calls_NeverAllow_Placeholder: String { return self._s[800]! } - public var Conversation_StatusTyping: String { return self._s[801]! } - public var Broadcast_AdminLog_EmptyText: String { return self._s[802]! } - public var Notification_PassportValueProofOfAddress: String { return self._s[803]! } - public var UserInfo_CreateNewContact: String { return self._s[804]! } - public var Passport_Identity_FrontSide: String { return self._s[805]! } - public var Calls_CallTabTitle: String { return self._s[806]! } - public var Channel_AdminLog_ChannelEmptyText: String { return self._s[807]! } + public var PrivacyLastSeenSettings_GroupsAndChannelsHelp: String { return self._s[797]! } + public var Privacy_Calls_NeverAllow_Placeholder: String { return self._s[798]! } + public var Conversation_StatusTyping: String { return self._s[799]! } + public var Broadcast_AdminLog_EmptyText: String { return self._s[800]! } + public var Notification_PassportValueProofOfAddress: String { return self._s[801]! } + public var UserInfo_CreateNewContact: String { return self._s[802]! } + public var Passport_Identity_FrontSide: String { return self._s[803]! } + public var Calls_CallTabTitle: String { return self._s[804]! } + public var Channel_AdminLog_ChannelEmptyText: String { return self._s[805]! } public func Login_BannedPhoneBody(_ _0: String) -> (String, [(Int, NSRange)]) { - return formatWithArgumentRanges(self._s[808]!, self._r[808]!, [_0]) + return formatWithArgumentRanges(self._s[806]!, self._r[806]!, [_0]) } - public var Watch_UserInfo_MuteTitle: String { return self._s[809]! } - public var SharedMedia_EmptyMusicText: String { return self._s[810]! } - public var PasscodeSettings_AutoLock_IfAwayFor_1minute: String { return self._s[811]! } - public var Paint_Stickers: String { return self._s[812]! } - public var Privacy_GroupsAndChannels: String { return self._s[813]! } - public var UserInfo_AddContact: String { return self._s[815]! } + public var Watch_UserInfo_MuteTitle: String { return self._s[807]! } + public var SharedMedia_EmptyMusicText: String { return self._s[808]! } + public var PasscodeSettings_AutoLock_IfAwayFor_1minute: String { return self._s[809]! } + public var Paint_Stickers: String { return self._s[810]! } + public var Privacy_GroupsAndChannels: String { return self._s[811]! } + public var UserInfo_AddContact: String { return self._s[813]! } public func Conversation_MessageViaUser(_ _0: String) -> (String, [(Int, NSRange)]) { - return formatWithArgumentRanges(self._s[816]!, self._r[816]!, [_0]) + return formatWithArgumentRanges(self._s[814]!, self._r[814]!, [_0]) } - public var PhoneNumberHelp_ChangeNumber: String { return self._s[818]! } - public var DialogList_NoMessagesTitle: String { return self._s[820]! } - public var EditProfile_NameAndPhotoHelp: String { return self._s[821]! } - public var BlockedUsers_BlockUser: String { return self._s[822]! } - public var MediaPicker_UngroupDescription: String { return self._s[823]! } - public var Watch_NoConnection: String { return self._s[824]! } - public var Month_GenSeptember: String { return self._s[825]! } - public var Conversation_ViewGroup: String { return self._s[826]! } - public var Channel_AdminLogFilter_EventsLeavingSubscribers: String { return self._s[829]! } - public var Passport_FieldOneOf_FinalDelimeter: String { return self._s[830]! } - public var MediaPicker_CameraRoll: String { return self._s[832]! } - public var Month_GenAugust: String { return self._s[833]! } - public var AccessDenied_VideoMessageMicrophone: String { return self._s[834]! } - public var SharedMedia_EmptyText: String { return self._s[835]! } - public var Map_ShareLiveLocation: String { return self._s[836]! } - public var Calls_All: String { return self._s[837]! } - public var Appearance_ThemeNight: String { return self._s[840]! } - public var Conversation_HoldForAudio: String { return self._s[841]! } - public var GroupInfo_GroupHistoryHidden: String { return self._s[844]! } - public var SocksProxySetup_Secret: String { return self._s[845]! } - public var Channel_BanList_RestrictedTitle: String { return self._s[847]! } - public var Conversation_Location: String { return self._s[848]! } - public var ChatSettings_AutoDownloadPhotos: String { return self._s[850]! } - public var Notifications_PermissionsText: String { return self._s[851]! } - public var SocksProxySetup_ProxyStatusConnecting: String { return self._s[852]! } - public var Channel_EditAdmin_PermissionPinMessages: String { return self._s[854]! } - public var TwoStepAuth_ReEnterPasswordDescription: String { return self._s[855]! } - public var Passport_DeletePassportConfirmation: String { return self._s[858]! } - public var Login_InvalidCodeError: String { return self._s[859]! } - public var StickerPacksSettings_FeaturedPacks: String { return self._s[860]! } + public var PhoneNumberHelp_ChangeNumber: String { return self._s[816]! } + public var DialogList_NoMessagesTitle: String { return self._s[818]! } + public var EditProfile_NameAndPhotoHelp: String { return self._s[819]! } + public var BlockedUsers_BlockUser: String { return self._s[820]! } + public var MediaPicker_UngroupDescription: String { return self._s[821]! } + public var Watch_NoConnection: String { return self._s[822]! } + public var Month_GenSeptember: String { return self._s[823]! } + public var Conversation_ViewGroup: String { return self._s[824]! } + public var Channel_AdminLogFilter_EventsLeavingSubscribers: String { return self._s[827]! } + public var Passport_FieldOneOf_FinalDelimeter: String { return self._s[828]! } + public var MediaPicker_CameraRoll: String { return self._s[830]! } + public var Month_GenAugust: String { return self._s[831]! } + public var AccessDenied_VideoMessageMicrophone: String { return self._s[832]! } + public var SharedMedia_EmptyText: String { return self._s[833]! } + public var Map_ShareLiveLocation: String { return self._s[834]! } + public var Calls_All: String { return self._s[835]! } + public var Appearance_ThemeNight: String { return self._s[838]! } + public var Conversation_HoldForAudio: String { return self._s[839]! } + public var GroupInfo_GroupHistoryHidden: String { return self._s[842]! } + public var SocksProxySetup_Secret: String { return self._s[843]! } + public var Channel_BanList_RestrictedTitle: String { return self._s[845]! } + public var Conversation_Location: String { return self._s[846]! } + public var ChatSettings_AutoDownloadPhotos: String { return self._s[848]! } + public var Notifications_PermissionsText: String { return self._s[849]! } + public var SocksProxySetup_ProxyStatusConnecting: String { return self._s[850]! } + public var Channel_EditAdmin_PermissionPinMessages: String { return self._s[852]! } + public var TwoStepAuth_ReEnterPasswordDescription: String { return self._s[853]! } + public var Passport_DeletePassportConfirmation: String { return self._s[856]! } + public var Login_InvalidCodeError: String { return self._s[857]! } + public var StickerPacksSettings_FeaturedPacks: String { return self._s[858]! } public func GroupInfo_InvitationLinkAcceptChannel(_ _0: String) -> (String, [(Int, NSRange)]) { - return formatWithArgumentRanges(self._s[861]!, self._r[861]!, [_0]) + return formatWithArgumentRanges(self._s[859]!, self._r[859]!, [_0]) } - public var Call_CallInProgressTitle: String { return self._s[862]! } - public var Month_ShortSeptember: String { return self._s[863]! } - public var Watch_ChannelInfo_Title: String { return self._s[864]! } - public var DialogList_PasscodeLockHelp: String { return self._s[867]! } - public var Notifications_Badge_IncludePublicGroups: String { return self._s[868]! } - public var Channel_AdminLogFilter_EventsTitle: String { return self._s[869]! } - public var PhotoEditor_CropReset: String { return self._s[870]! } - public var Group_Username_CreatePrivateLinkHelp: String { return self._s[872]! } - public var Channel_Management_LabelEditor: String { return self._s[873]! } - public var Passport_Identity_LatinNameHelp: String { return self._s[875]! } - public var PhotoEditor_HighlightsTool: String { return self._s[876]! } - public var UserInfo_Title: String { return self._s[877]! } - public var AccessDenied_Title: String { return self._s[878]! } - public var DialogList_SearchLabel: String { return self._s[879]! } - public var Group_Setup_HistoryHidden: String { return self._s[880]! } - public var TwoStepAuth_PasswordChangeSuccess: String { return self._s[881]! } - public var State_Updating: String { return self._s[883]! } - public var Contacts_TabTitle: String { return self._s[884]! } - public var Notifications_Badge_CountUnreadMessages: String { return self._s[886]! } - public var GroupInfo_GroupHistory: String { return self._s[887]! } - public var CheckoutInfo_ShippingInfoCountry: String { return self._s[888]! } - public var Passport_Identity_OneOfTypeDriversLicense: String { return self._s[889]! } - public var Contacts_NotRegisteredSection: String { return self._s[890]! } + public var Call_CallInProgressTitle: String { return self._s[860]! } + public var Month_ShortSeptember: String { return self._s[861]! } + public var Watch_ChannelInfo_Title: String { return self._s[862]! } + public var DialogList_PasscodeLockHelp: String { return self._s[865]! } + public var Notifications_Badge_IncludePublicGroups: String { return self._s[866]! } + public var Channel_AdminLogFilter_EventsTitle: String { return self._s[867]! } + public var PhotoEditor_CropReset: String { return self._s[868]! } + public var Group_Username_CreatePrivateLinkHelp: String { return self._s[870]! } + public var Channel_Management_LabelEditor: String { return self._s[871]! } + public var Passport_Identity_LatinNameHelp: String { return self._s[873]! } + public var PhotoEditor_HighlightsTool: String { return self._s[874]! } + public var UserInfo_Title: String { return self._s[875]! } + public var AccessDenied_Title: String { return self._s[876]! } + public var DialogList_SearchLabel: String { return self._s[877]! } + public var Group_Setup_HistoryHidden: String { return self._s[878]! } + public var TwoStepAuth_PasswordChangeSuccess: String { return self._s[879]! } + public var State_Updating: String { return self._s[881]! } + public var Contacts_TabTitle: String { return self._s[882]! } + public var Notifications_Badge_CountUnreadMessages: String { return self._s[884]! } + public var GroupInfo_GroupHistory: String { return self._s[885]! } + public var CheckoutInfo_ShippingInfoCountry: String { return self._s[886]! } + public var Passport_Identity_OneOfTypeDriversLicense: String { return self._s[887]! } + public var Contacts_NotRegisteredSection: String { return self._s[888]! } public func Time_PreciseDate_m4(_ _1: String, _ _2: String, _ _3: String) -> (String, [(Int, NSRange)]) { - return formatWithArgumentRanges(self._s[891]!, self._r[891]!, [_1, _2, _3]) + return formatWithArgumentRanges(self._s[889]!, self._r[889]!, [_1, _2, _3]) } - public var Paint_Clear: String { return self._s[892]! } - public var StickerPacksSettings_ArchivedMasks: String { return self._s[893]! } - public var SocksProxySetup_Connecting: String { return self._s[894]! } - public var ExplicitContent_AlertChannel: String { return self._s[895]! } - public var Conversation_Contact: String { return self._s[896]! } - public var Login_CodeExpired: String { return self._s[897]! } - public var Passport_DiscardMessageAction: String { return self._s[898]! } - public var Channel_AdminLog_MessagePreviousDescription: String { return self._s[899]! } - public var Channel_AdminLog_EmptyMessageText: String { return self._s[900]! } - public var Month_ShortApril: String { return self._s[901]! } - public var AuthSessions_CurrentSession: String { return self._s[902]! } - public var PrivacySettings_DeleteAccountIfAwayFor: String { return self._s[906]! } - public var CheckoutInfo_ShippingInfoTitle: String { return self._s[907]! } - public var Channel_Setup_TypePrivate: String { return self._s[909]! } - public var Forward_ChannelReadOnly: String { return self._s[912]! } - public var PhotoEditor_CurvesBlue: String { return self._s[913]! } - public var UserInfo_BotPrivacy: String { return self._s[914]! } - public var Notification_PassportValueEmail: String { return self._s[915]! } - public var Channel_SignMessages_Help: String { return self._s[917]! } + public var Paint_Clear: String { return self._s[890]! } + public var StickerPacksSettings_ArchivedMasks: String { return self._s[891]! } + public var SocksProxySetup_Connecting: String { return self._s[892]! } + public var ExplicitContent_AlertChannel: String { return self._s[893]! } + public var Conversation_Contact: String { return self._s[894]! } + public var Login_CodeExpired: String { return self._s[895]! } + public var Passport_DiscardMessageAction: String { return self._s[896]! } + public var Channel_AdminLog_MessagePreviousDescription: String { return self._s[897]! } + public var Channel_AdminLog_EmptyMessageText: String { return self._s[898]! } + public var Month_ShortApril: String { return self._s[899]! } + public var AuthSessions_CurrentSession: String { return self._s[900]! } + public var PrivacySettings_DeleteAccountIfAwayFor: String { return self._s[904]! } + public var CheckoutInfo_ShippingInfoTitle: String { return self._s[905]! } + public var Channel_Setup_TypePrivate: String { return self._s[907]! } + public var Forward_ChannelReadOnly: String { return self._s[910]! } + public var PhotoEditor_CurvesBlue: String { return self._s[911]! } + public var UserInfo_BotPrivacy: String { return self._s[912]! } + public var Notification_PassportValueEmail: String { return self._s[913]! } + public var Channel_SignMessages_Help: String { return self._s[915]! } public func CHAT_LEFT(_ _1: String, _ _2: String) -> (String, [(Int, NSRange)]) { - return formatWithArgumentRanges(self._s[919]!, self._r[919]!, [_1, _2]) + return formatWithArgumentRanges(self._s[917]!, self._r[917]!, [_1, _2]) } - public var ChannelMembers_WhoCanAddMembers_Admins: String { return self._s[920]! } - public var FastTwoStepSetup_EmailPlaceholder: String { return self._s[921]! } - public var Passport_Language_pt: String { return self._s[922]! } - public var NotificationsSound_Popcorn: String { return self._s[925]! } - public var AutoNightTheme_Disabled: String { return self._s[926]! } - public var BlockedUsers_LeavePrefix: String { return self._s[927]! } + public var ChannelMembers_WhoCanAddMembers_Admins: String { return self._s[918]! } + public var FastTwoStepSetup_EmailPlaceholder: String { return self._s[919]! } + public var Passport_Language_pt: String { return self._s[920]! } + public var NotificationsSound_Popcorn: String { return self._s[923]! } + public var AutoNightTheme_Disabled: String { return self._s[924]! } + public var BlockedUsers_LeavePrefix: String { return self._s[925]! } public func CancelResetAccount_TextSMS(_ _0: String) -> (String, [(Int, NSRange)]) { - return formatWithArgumentRanges(self._s[928]!, self._r[928]!, [_0]) + return formatWithArgumentRanges(self._s[926]!, self._r[926]!, [_0]) } - public var CheckoutInfo_ErrorNameInvalid: String { return self._s[929]! } - public var SocksProxySetup_UseForCalls: String { return self._s[930]! } - public var Passport_DeleteDocumentConfirmation: String { return self._s[931]! } + public var CheckoutInfo_ErrorNameInvalid: String { return self._s[927]! } + public var SocksProxySetup_UseForCalls: String { return self._s[928]! } + public var Passport_DeleteDocumentConfirmation: String { return self._s[929]! } public func Conversation_Megabytes(_ _0: Float) -> (String, [(Int, NSRange)]) { - return formatWithArgumentRanges(self._s[932]!, self._r[932]!, ["\(_0)"]) + return formatWithArgumentRanges(self._s[930]!, self._r[930]!, ["\(_0)"]) } - public var SocksProxySetup_Hostname: String { return self._s[934]! } - public var Compose_NewEncryptedChat: String { return self._s[935]! } - public var Login_CodeFloodError: String { return self._s[936]! } - public var Calls_TabTitle: String { return self._s[937]! } - public var Passport_Language_he: String { return self._s[938]! } + public var SocksProxySetup_Hostname: String { return self._s[932]! } + public var Compose_NewEncryptedChat: String { return self._s[933]! } + public var Login_CodeFloodError: String { return self._s[934]! } + public var Calls_TabTitle: String { return self._s[935]! } + public var Passport_Language_he: String { return self._s[936]! } public func Channel_AdminLog_MessageGroupPreHistoryHidden(_ _0: String) -> (String, [(Int, NSRange)]) { - return formatWithArgumentRanges(self._s[939]!, self._r[939]!, [_0]) + return formatWithArgumentRanges(self._s[937]!, self._r[937]!, [_0]) } - public var Tour_Text1: String { return self._s[940]! } - public var Month_ShortFebruary: String { return self._s[941]! } - public var TwoStepAuth_EmailSkip: String { return self._s[942]! } - public var NotificationsSound_Glass: String { return self._s[943]! } - public var Appearance_ThemeNightBlue: String { return self._s[944]! } - public var CheckoutInfo_Pay: String { return self._s[945]! } - public var Invite_LargeRecipientsCountWarning: String { return self._s[947]! } - public var Call_CallAgain: String { return self._s[949]! } - public var AttachmentMenu_SendAsFile: String { return self._s[950]! } - public var Watch_Message_Game: String { return self._s[951]! } - public var AccessDenied_MicrophoneRestricted: String { return self._s[952]! } - public var Passport_InvalidPasswordError: String { return self._s[953]! } + public var Tour_Text1: String { return self._s[938]! } + public var Month_ShortFebruary: String { return self._s[939]! } + public var TwoStepAuth_EmailSkip: String { return self._s[940]! } + public var NotificationsSound_Glass: String { return self._s[941]! } + public var Appearance_ThemeNightBlue: String { return self._s[942]! } + public var CheckoutInfo_Pay: String { return self._s[943]! } + public var Invite_LargeRecipientsCountWarning: String { return self._s[945]! } + public var Call_CallAgain: String { return self._s[947]! } + public var AttachmentMenu_SendAsFile: String { return self._s[948]! } + public var Watch_Message_Game: String { return self._s[949]! } + public var AccessDenied_MicrophoneRestricted: String { return self._s[950]! } + public var Passport_InvalidPasswordError: String { return self._s[951]! } public func PINNED_PHOTO(_ _1: String) -> (String, [(Int, NSRange)]) { - return formatWithArgumentRanges(self._s[954]!, self._r[954]!, [_1]) + return formatWithArgumentRanges(self._s[952]!, self._r[952]!, [_1]) } - public var Stickers_Install: String { return self._s[955]! } - public var PrivacyLastSeenSettings_NeverShareWith: String { return self._s[956]! } - public var Passport_Identity_ResidenceCountry: String { return self._s[958]! } - public var Notifications_GroupNotificationsHelp: String { return self._s[959]! } - public var AuthSessions_OtherSessions: String { return self._s[960]! } - public var Channel_Username_Help: String { return self._s[961]! } - public var Camera_Title: String { return self._s[962]! } - public var GroupInfo_SetGroupPhotoDelete: String { return self._s[964]! } - public var Channel_AdminLog_TitleAllEvents: String { return self._s[965]! } - public var Contacts_MemberSearchSectionTitleGroup: String { return self._s[966]! } - public var Conversation_RestrictedStickers: String { return self._s[967]! } - public var Notifications_ExceptionsResetToDefaults: String { return self._s[969]! } - public var UserInfo_TelegramCall: String { return self._s[971]! } - public var TwoStepAuth_SetupResendEmailCode: String { return self._s[972]! } - public var Privacy_GroupsAndChannels_AlwaysAllow_Title: String { return self._s[973]! } - public var Passport_Identity_EditPersonalDetails: String { return self._s[974]! } + public var Stickers_Install: String { return self._s[953]! } + public var PrivacyLastSeenSettings_NeverShareWith: String { return self._s[954]! } + public var Passport_Identity_ResidenceCountry: String { return self._s[956]! } + public var Notifications_GroupNotificationsHelp: String { return self._s[957]! } + public var AuthSessions_OtherSessions: String { return self._s[958]! } + public var Channel_Username_Help: String { return self._s[959]! } + public var Camera_Title: String { return self._s[960]! } + public var GroupInfo_SetGroupPhotoDelete: String { return self._s[962]! } + public var Channel_AdminLog_TitleAllEvents: String { return self._s[963]! } + public var Contacts_MemberSearchSectionTitleGroup: String { return self._s[964]! } + public var Conversation_RestrictedStickers: String { return self._s[965]! } + public var Notifications_ExceptionsResetToDefaults: String { return self._s[967]! } + public var UserInfo_TelegramCall: String { return self._s[969]! } + public var TwoStepAuth_SetupResendEmailCode: String { return self._s[970]! } + public var Privacy_GroupsAndChannels_AlwaysAllow_Title: String { return self._s[971]! } + public var Passport_Identity_EditPersonalDetails: String { return self._s[972]! } public func Time_PreciseDate_m1(_ _1: String, _ _2: String, _ _3: String) -> (String, [(Int, NSRange)]) { - return formatWithArgumentRanges(self._s[975]!, self._r[975]!, [_1, _2, _3]) + return formatWithArgumentRanges(self._s[973]!, self._r[973]!, [_1, _2, _3]) } - public var Settings_SaveEditedPhotos: String { return self._s[976]! } - public var TwoStepAuth_ConfirmationTitle: String { return self._s[977]! } - public var Privacy_GroupsAndChannels_NeverAllow_Title: String { return self._s[978]! } - public var Conversation_MessageDialogRetry: String { return self._s[979]! } - public var Conversation_DiscardVoiceMessageAction: String { return self._s[980]! } - public var Group_Setup_TypeHeader: String { return self._s[981]! } - public var Paint_RecentStickers: String { return self._s[982]! } - public var PhotoEditor_GrainTool: String { return self._s[983]! } - public var CheckoutInfo_ShippingInfoState: String { return self._s[984]! } - public var Watch_AuthRequired: String { return self._s[986]! } + public var Settings_SaveEditedPhotos: String { return self._s[974]! } + public var TwoStepAuth_ConfirmationTitle: String { return self._s[975]! } + public var Privacy_GroupsAndChannels_NeverAllow_Title: String { return self._s[976]! } + public var Conversation_MessageDialogRetry: String { return self._s[977]! } + public var Conversation_DiscardVoiceMessageAction: String { return self._s[978]! } + public var Group_Setup_TypeHeader: String { return self._s[979]! } + public var Paint_RecentStickers: String { return self._s[980]! } + public var PhotoEditor_GrainTool: String { return self._s[981]! } + public var CheckoutInfo_ShippingInfoState: String { return self._s[982]! } + public var Watch_AuthRequired: String { return self._s[984]! } public func Passport_Email_UseTelegramEmail(_ _0: String) -> (String, [(Int, NSRange)]) { - return formatWithArgumentRanges(self._s[987]!, self._r[987]!, [_0]) + return formatWithArgumentRanges(self._s[985]!, self._r[985]!, [_0]) } public func CHANNEL_MESSAGE_PHOTOS(_ _1: String, _ _2: String) -> (String, [(Int, NSRange)]) { - return formatWithArgumentRanges(self._s[988]!, self._r[988]!, [_1, _2]) + return formatWithArgumentRanges(self._s[986]!, self._r[986]!, [_1, _2]) } - public var Conversation_EncryptedDescriptionTitle: String { return self._s[989]! } - public var ChannelIntro_Text: String { return self._s[990]! } - public var DialogList_DeleteBotConfirmation: String { return self._s[991]! } - public var Calls_AddTab: String { return self._s[992]! } - public var Message_ReplyActionButtonShowReceipt: String { return self._s[993]! } - public var Channel_AdminLog_EmptyFilterText: String { return self._s[994]! } - public var Notification_MessageLifetime1d: String { return self._s[995]! } - public var Notifications_ChannelNotificationsExceptionsHelp: String { return self._s[996]! } - public var Channel_BanUser_PermissionsHeader: String { return self._s[997]! } - public var Passport_Identity_GenderFemale: String { return self._s[998]! } - public var BlockedUsers_BlockTitle: String { return self._s[999]! } + public var Conversation_EncryptedDescriptionTitle: String { return self._s[987]! } + public var ChannelIntro_Text: String { return self._s[988]! } + public var DialogList_DeleteBotConfirmation: String { return self._s[989]! } + public var Calls_AddTab: String { return self._s[990]! } + public var Message_ReplyActionButtonShowReceipt: String { return self._s[991]! } + public var Channel_AdminLog_EmptyFilterText: String { return self._s[992]! } + public var Notification_MessageLifetime1d: String { return self._s[993]! } + public var Notifications_ChannelNotificationsExceptionsHelp: String { return self._s[994]! } + public var Channel_BanUser_PermissionsHeader: String { return self._s[995]! } + public var Passport_Identity_GenderFemale: String { return self._s[996]! } + public var BlockedUsers_BlockTitle: String { return self._s[997]! } public func MESSAGE_AUDIO(_ _1: String) -> (String, [(Int, NSRange)]) { - return formatWithArgumentRanges(self._s[1000]!, self._r[1000]!, [_1]) + return formatWithArgumentRanges(self._s[998]!, self._r[998]!, [_1]) } - public var Weekday_Yesterday: String { return self._s[1001]! } - public var AutoNightTheme_Scheduled: String { return self._s[1002]! } - public var PrivacyPolicy_DeclineDeleteNow: String { return self._s[1003]! } - public var Permissions_SiriText: String { return self._s[1004]! } - public var Channel_Members_AddBannedErrorAdmin: String { return self._s[1005]! } + public var Weekday_Yesterday: String { return self._s[999]! } + public var AutoNightTheme_Scheduled: String { return self._s[1000]! } + public var PrivacyPolicy_DeclineDeleteNow: String { return self._s[1001]! } + public var Channel_Members_AddBannedErrorAdmin: String { return self._s[1002]! } public func Notification_CallFormat(_ _1: String, _ _2: String) -> (String, [(Int, NSRange)]) { - return formatWithArgumentRanges(self._s[1006]!, self._r[1006]!, [_1, _2]) + return formatWithArgumentRanges(self._s[1003]!, self._r[1003]!, [_1, _2]) } - public var Checkout_ErrorProviderAccountInvalid: String { return self._s[1007]! } - public var Notifications_InAppNotificationsSounds: String { return self._s[1008]! } - public var Preview_OpenInInstagram: String { return self._s[1009]! } - public var Notification_MessageLifetimeRemovedOutgoing: String { return self._s[1010]! } - public var Permissions_NotificationsAllow: String { return self._s[1011]! } + public var Checkout_ErrorProviderAccountInvalid: String { return self._s[1004]! } + public var Notifications_InAppNotificationsSounds: String { return self._s[1005]! } + public var Preview_OpenInInstagram: String { return self._s[1006]! } + public var Notification_MessageLifetimeRemovedOutgoing: String { return self._s[1007]! } public func Passport_PrivacyPolicy(_ _1: String, _ _2: String) -> (String, [(Int, NSRange)]) { - return formatWithArgumentRanges(self._s[1012]!, self._r[1012]!, [_1, _2]) + return formatWithArgumentRanges(self._s[1008]!, self._r[1008]!, [_1, _2]) } - public var Channel_AdminLog_InfoPanelAlertTitle: String { return self._s[1013]! } - public var NetworkUsageSettings_TotalSection: String { return self._s[1014]! } - public var Channel_Setup_TypePrivateHelp: String { return self._s[1015]! } - public var Wallpaper_PhotoLibrary: String { return self._s[1017]! } - public var Privacy_GroupsAndChannels_NeverAllow_Placeholder: String { return self._s[1018]! } - public var FastTwoStepSetup_HintSection: String { return self._s[1019]! } - public var TwoStepAuth_SetupResendEmailCodeAlert: String { return self._s[1020]! } - public var Watch_LastSeen_WithinAMonth: String { return self._s[1021]! } - public var GroupInfo_ActionPromote: String { return self._s[1022]! } - public var PasscodeSettings_SimplePasscode: String { return self._s[1023]! } - public var PrivacySettings_DataSettingsHelp: String { return self._s[1026]! } - public var Passport_FieldEmailHelp: String { return self._s[1027]! } - public var Passport_Identity_GenderPlaceholder: String { return self._s[1028]! } - public var Weekday_ShortSaturday: String { return self._s[1029]! } - public var ContactInfo_PhoneLabelMain: String { return self._s[1030]! } - public var Watch_Conversation_UserInfo: String { return self._s[1031]! } - public var CheckoutInfo_ShippingInfoCityPlaceholder: String { return self._s[1032]! } - public var PrivacyLastSeenSettings_Title: String { return self._s[1033]! } - public var Conversation_ShareBotLocationConfirmation: String { return self._s[1034]! } - public var PhotoEditor_VignetteTool: String { return self._s[1035]! } - public var Passport_Address_Street1Placeholder: String { return self._s[1036]! } - public var Passport_Language_et: String { return self._s[1037]! } - public var Passport_Language_bg: String { return self._s[1038]! } - public var Stickers_NoStickersFound: String { return self._s[1040]! } - public var Settings_About: String { return self._s[1041]! } + public var Channel_AdminLog_InfoPanelAlertTitle: String { return self._s[1009]! } + public var NetworkUsageSettings_TotalSection: String { return self._s[1010]! } + public var Channel_Setup_TypePrivateHelp: String { return self._s[1011]! } + public var Wallpaper_PhotoLibrary: String { return self._s[1013]! } + public var Privacy_GroupsAndChannels_NeverAllow_Placeholder: String { return self._s[1014]! } + public var FastTwoStepSetup_HintSection: String { return self._s[1015]! } + public var TwoStepAuth_SetupResendEmailCodeAlert: String { return self._s[1016]! } + public var Watch_LastSeen_WithinAMonth: String { return self._s[1017]! } + public var GroupInfo_ActionPromote: String { return self._s[1018]! } + public var PasscodeSettings_SimplePasscode: String { return self._s[1019]! } + public var Permissions_ContactsText_v0: String { return self._s[1020]! } + public var PrivacySettings_DataSettingsHelp: String { return self._s[1023]! } + public var Passport_FieldEmailHelp: String { return self._s[1024]! } + public var Passport_Identity_GenderPlaceholder: String { return self._s[1025]! } + public var Weekday_ShortSaturday: String { return self._s[1026]! } + public var ContactInfo_PhoneLabelMain: String { return self._s[1027]! } + public var Watch_Conversation_UserInfo: String { return self._s[1028]! } + public var CheckoutInfo_ShippingInfoCityPlaceholder: String { return self._s[1029]! } + public var PrivacyLastSeenSettings_Title: String { return self._s[1030]! } + public var Conversation_ShareBotLocationConfirmation: String { return self._s[1031]! } + public var PhotoEditor_VignetteTool: String { return self._s[1032]! } + public var Passport_Address_Street1Placeholder: String { return self._s[1033]! } + public var Passport_Language_et: String { return self._s[1034]! } + public var Passport_Language_bg: String { return self._s[1035]! } + public var Stickers_NoStickersFound: String { return self._s[1037]! } + public var Settings_About: String { return self._s[1038]! } public func Channel_AdminLog_MessageRestricted(_ _0: String, _ _1: String, _ _2: String) -> (String, [(Int, NSRange)]) { - return formatWithArgumentRanges(self._s[1042]!, self._r[1042]!, [_0, _1, _2]) + return formatWithArgumentRanges(self._s[1039]!, self._r[1039]!, [_0, _1, _2]) } - public var KeyCommand_NewMessage: String { return self._s[1044]! } - public var Group_ErrorAddBlocked: String { return self._s[1045]! } + public var KeyCommand_NewMessage: String { return self._s[1041]! } + public var Group_ErrorAddBlocked: String { return self._s[1042]! } public func Message_PaymentSent(_ _0: String) -> (String, [(Int, NSRange)]) { - return formatWithArgumentRanges(self._s[1046]!, self._r[1046]!, [_0]) + return formatWithArgumentRanges(self._s[1043]!, self._r[1043]!, [_0]) } - public var Map_LocationTitle: String { return self._s[1047]! } - public var CallSettings_UseLessDataLongDescription: String { return self._s[1048]! } - public var Cache_ClearProgress: String { return self._s[1049]! } + public var Map_LocationTitle: String { return self._s[1044]! } + public var CallSettings_UseLessDataLongDescription: String { return self._s[1045]! } + public var Cache_ClearProgress: String { return self._s[1046]! } public func Channel_Management_ErrorNotMember(_ _0: String) -> (String, [(Int, NSRange)]) { - return formatWithArgumentRanges(self._s[1050]!, self._r[1050]!, [_0]) + return formatWithArgumentRanges(self._s[1047]!, self._r[1047]!, [_0]) } - public var Passport_UpdateRequiredError: String { return self._s[1051]! } - public var Passport_Identity_MainPageHelp: String { return self._s[1053]! } - public var Conversation_StatusKickedFromGroup: String { return self._s[1054]! } - public var Passport_Language_ka: String { return self._s[1055]! } - public var Permissions_SiriAllowInSettings: String { return self._s[1056]! } - public var Call_Decline: String { return self._s[1057]! } - public var SocksProxySetup_ProxyEnabled: String { return self._s[1058]! } + public var Passport_UpdateRequiredError: String { return self._s[1048]! } + public var Passport_Identity_MainPageHelp: String { return self._s[1050]! } + public var Conversation_StatusKickedFromGroup: String { return self._s[1051]! } + public var Passport_Language_ka: String { return self._s[1052]! } + public var Call_Decline: String { return self._s[1053]! } + public var SocksProxySetup_ProxyEnabled: String { return self._s[1054]! } public func AuthCode_Alert(_ _0: String) -> (String, [(Int, NSRange)]) { - return formatWithArgumentRanges(self._s[1061]!, self._r[1061]!, [_0]) + return formatWithArgumentRanges(self._s[1057]!, self._r[1057]!, [_0]) } public func Channel_AdminLog_MessagePromotedNameUsername(_ _1: String, _ _2: String) -> (String, [(Int, NSRange)]) { - return formatWithArgumentRanges(self._s[1062]!, self._r[1062]!, [_1, _2]) + return formatWithArgumentRanges(self._s[1058]!, self._r[1058]!, [_1, _2]) } - public var Passport_Phone_UseTelegramNumberHelp: String { return self._s[1063]! } - public var Passport_DeletePassport: String { return self._s[1065]! } - public var Privacy_Calls_P2PAlways: String { return self._s[1066]! } - public var Month_ShortDecember: String { return self._s[1067]! } - public var Channel_AdminLog_CanEditMessages: String { return self._s[1069]! } + public var Passport_Phone_UseTelegramNumberHelp: String { return self._s[1059]! } + public var Passport_DeletePassport: String { return self._s[1061]! } + public var Privacy_Calls_P2PAlways: String { return self._s[1062]! } + public var Month_ShortDecember: String { return self._s[1063]! } + public var Channel_AdminLog_CanEditMessages: String { return self._s[1065]! } public func Contacts_AccessDeniedHelpLandscape(_ _0: String) -> (String, [(Int, NSRange)]) { - return formatWithArgumentRanges(self._s[1070]!, self._r[1070]!, [_0]) + return formatWithArgumentRanges(self._s[1066]!, self._r[1066]!, [_0]) } - public var Channel_Stickers_Searching: String { return self._s[1071]! } - public var Conversation_EncryptedDescription1: String { return self._s[1072]! } - public var Conversation_EncryptedDescription2: String { return self._s[1073]! } - public var Conversation_EncryptedDescription3: String { return self._s[1074]! } - public var PhotoEditor_SharpenTool: String { return self._s[1075]! } + public var Channel_Stickers_Searching: String { return self._s[1067]! } + public var Conversation_EncryptedDescription1: String { return self._s[1068]! } + public var Conversation_EncryptedDescription2: String { return self._s[1069]! } + public var Conversation_EncryptedDescription3: String { return self._s[1070]! } + public var PhotoEditor_SharpenTool: String { return self._s[1071]! } public func ENCRYPTED_MESSAGE(_ _1: String) -> (String, [(Int, NSRange)]) { - return formatWithArgumentRanges(self._s[1076]!, self._r[1076]!, [_1]) + return formatWithArgumentRanges(self._s[1072]!, self._r[1072]!, [_1]) } - public var Conversation_EncryptedDescription4: String { return self._s[1078]! } - public var Channel_Members_AddMembers: String { return self._s[1079]! } - public var Weekday_Friday: String { return self._s[1080]! } - public var Privacy_ContactsSync: String { return self._s[1081]! } - public var ApplyLanguage_ChangeLanguageAction: String { return self._s[1082]! } + public var Conversation_EncryptedDescription4: String { return self._s[1074]! } + public var Channel_Members_AddMembers: String { return self._s[1075]! } + public var Weekday_Friday: String { return self._s[1076]! } + public var Privacy_ContactsSync: String { return self._s[1077]! } + public var ApplyLanguage_ChangeLanguageAction: String { return self._s[1078]! } public func Channel_Management_RestrictedBy(_ _0: String) -> (String, [(Int, NSRange)]) { - return formatWithArgumentRanges(self._s[1083]!, self._r[1083]!, [_0]) + return formatWithArgumentRanges(self._s[1079]!, self._r[1079]!, [_0]) } - public var Passport_Identity_GenderMale: String { return self._s[1084]! } + public var Passport_Identity_GenderMale: String { return self._s[1080]! } public func Call_StatusBar(_ _0: String) -> (String, [(Int, NSRange)]) { - return formatWithArgumentRanges(self._s[1085]!, self._r[1085]!, [_0]) + return formatWithArgumentRanges(self._s[1081]!, self._r[1081]!, [_0]) } - public var Conversation_JumpToDate: String { return self._s[1086]! } - public var Contacts_GlobalSearch: String { return self._s[1087]! } - public var AutoDownloadSettings_ResetHelp: String { return self._s[1088]! } - public var Profile_MessageLifetime1d: String { return self._s[1089]! } - public var Permissions_CellularDataAllowInSettings: String { return self._s[1090]! } + public var Conversation_JumpToDate: String { return self._s[1082]! } + public var Contacts_GlobalSearch: String { return self._s[1083]! } + public var AutoDownloadSettings_ResetHelp: String { return self._s[1084]! } + public var Profile_MessageLifetime1d: String { return self._s[1085]! } public func MESSAGE_INVOICE(_ _1: String, _ _2: String) -> (String, [(Int, NSRange)]) { - return formatWithArgumentRanges(self._s[1091]!, self._r[1091]!, [_1, _2]) + return formatWithArgumentRanges(self._s[1086]!, self._r[1086]!, [_1, _2]) } - public var StickerPack_BuiltinPackName: String { return self._s[1094]! } - public var Passport_InfoTitle: String { return self._s[1096]! } - public var Permissions_NotificationsText: String { return self._s[1100]! } + public var StickerPack_BuiltinPackName: String { return self._s[1089]! } + public var Passport_InfoTitle: String { return self._s[1091]! } + public var Notifications_PermissionsUnreachableText: String { return self._s[1092]! } public func NetworkUsageSettings_CellularUsageSince(_ _0: String) -> (String, [(Int, NSRange)]) { - return formatWithArgumentRanges(self._s[1101]!, self._r[1101]!, [_0]) + return formatWithArgumentRanges(self._s[1096]!, self._r[1096]!, [_0]) } - public var Passport_Address_TypePassportRegistrationUploadScan: String { return self._s[1102]! } - public var Profile_BotInfo: String { return self._s[1103]! } - public var Watch_Compose_CreateMessage: String { return self._s[1104]! } - public var Month_ShortNovember: String { return self._s[1105]! } + public var Passport_Address_TypePassportRegistrationUploadScan: String { return self._s[1097]! } + public var Profile_BotInfo: String { return self._s[1098]! } + public var Watch_Compose_CreateMessage: String { return self._s[1099]! } + public var Month_ShortNovember: String { return self._s[1100]! } public func PHONE_CALL_REQUEST(_ _1: String) -> (String, [(Int, NSRange)]) { - return formatWithArgumentRanges(self._s[1106]!, self._r[1106]!, [_1]) + return formatWithArgumentRanges(self._s[1101]!, self._r[1101]!, [_1]) } public func ENCRYPTION_REQUEST(_ _1: String) -> (String, [(Int, NSRange)]) { - return formatWithArgumentRanges(self._s[1107]!, self._r[1107]!, [_1]) + return formatWithArgumentRanges(self._s[1102]!, self._r[1102]!, [_1]) } - public var Passport_Identity_TranslationsHelp: String { return self._s[1108]! } - public var NotificationsSound_Chime: String { return self._s[1109]! } - public var Passport_Language_ko: String { return self._s[1111]! } - public var InviteText_URL: String { return self._s[1112]! } - public var TextFormat_Monospace: String { return self._s[1113]! } + public var Passport_Identity_TranslationsHelp: String { return self._s[1103]! } + public var NotificationsSound_Chime: String { return self._s[1104]! } + public var Passport_Language_ko: String { return self._s[1106]! } + public var InviteText_URL: String { return self._s[1107]! } + public var TextFormat_Monospace: String { return self._s[1108]! } public func Time_PreciseDate_m11(_ _1: String, _ _2: String, _ _3: String) -> (String, [(Int, NSRange)]) { - return formatWithArgumentRanges(self._s[1114]!, self._r[1114]!, [_1, _2, _3]) + return formatWithArgumentRanges(self._s[1109]!, self._r[1109]!, [_1, _2, _3]) } public func Login_WillSendSms(_ _0: String) -> (String, [(Int, NSRange)]) { - return formatWithArgumentRanges(self._s[1115]!, self._r[1115]!, [_0]) + return formatWithArgumentRanges(self._s[1110]!, self._r[1110]!, [_0]) } public func Watch_Time_ShortWeekdayAt(_ _1: String, _ _2: String) -> (String, [(Int, NSRange)]) { - return formatWithArgumentRanges(self._s[1116]!, self._r[1116]!, [_1, _2]) + return formatWithArgumentRanges(self._s[1111]!, self._r[1111]!, [_1, _2]) } - public var Passport_InfoLearnMore: String { return self._s[1118]! } - public var TwoStepAuth_EmailPlaceholder: String { return self._s[1119]! } - public var Passport_Identity_AddIdentityCard: String { return self._s[1120]! } - public var Your_card_has_expired: String { return self._s[1121]! } - public var StickerPacksSettings_StickerPacksSection: String { return self._s[1122]! } - public var GroupInfo_InviteLink_Help: String { return self._s[1123]! } - public var Conversation_Report: String { return self._s[1126]! } - public var Notifications_MessageNotificationsSound: String { return self._s[1127]! } - public var Notification_MessageLifetime1m: String { return self._s[1128]! } - public var Privacy_ContactsTitle: String { return self._s[1129]! } - public var Conversation_ShareMyContactInfo: String { return self._s[1130]! } - public var ChannelMembers_WhoCanAddMembersAdminsHelp: String { return self._s[1131]! } - public var Channel_Members_Title: String { return self._s[1132]! } - public var Map_OpenInWaze: String { return self._s[1133]! } - public var Login_PhoneBannedError: String { return self._s[1134]! } + public var Passport_InfoLearnMore: String { return self._s[1113]! } + public var TwoStepAuth_EmailPlaceholder: String { return self._s[1114]! } + public var Passport_Identity_AddIdentityCard: String { return self._s[1115]! } + public var Your_card_has_expired: String { return self._s[1116]! } + public var StickerPacksSettings_StickerPacksSection: String { return self._s[1117]! } + public var GroupInfo_InviteLink_Help: String { return self._s[1118]! } + public var Conversation_Report: String { return self._s[1121]! } + public var Notifications_MessageNotificationsSound: String { return self._s[1122]! } + public var Notification_MessageLifetime1m: String { return self._s[1123]! } + public var Privacy_ContactsTitle: String { return self._s[1124]! } + public var Conversation_ShareMyContactInfo: String { return self._s[1125]! } + public var ChannelMembers_WhoCanAddMembersAdminsHelp: String { return self._s[1126]! } + public var Channel_Members_Title: String { return self._s[1127]! } + public var Map_OpenInWaze: String { return self._s[1128]! } + public var Login_PhoneBannedError: String { return self._s[1129]! } public func LiveLocationUpdated_YesterdayAt(_ _0: String) -> (String, [(Int, NSRange)]) { - return formatWithArgumentRanges(self._s[1135]!, self._r[1135]!, [_0]) + return formatWithArgumentRanges(self._s[1130]!, self._r[1130]!, [_0]) } public func MESSAGE_PHOTO(_ _1: String) -> (String, [(Int, NSRange)]) { - return formatWithArgumentRanges(self._s[1136]!, self._r[1136]!, [_1]) + return formatWithArgumentRanges(self._s[1131]!, self._r[1131]!, [_1]) } - public var Group_Management_AddModeratorHelp: String { return self._s[1137]! } - public var Common_OK: String { return self._s[1138]! } - public var Passport_Address_TypeBankStatementUploadScan: String { return self._s[1139]! } - public var Cache_Music: String { return self._s[1140]! } - public var PasscodeSettings_UnlockWithTouchId: String { return self._s[1141]! } - public var TwoStepAuth_HintPlaceholder: String { return self._s[1142]! } + public var Group_Management_AddModeratorHelp: String { return self._s[1132]! } + public var Common_OK: String { return self._s[1133]! } + public var Passport_Address_TypeBankStatementUploadScan: String { return self._s[1134]! } + public var Cache_Music: String { return self._s[1135]! } + public var PasscodeSettings_UnlockWithTouchId: String { return self._s[1136]! } + public var TwoStepAuth_HintPlaceholder: String { return self._s[1137]! } public func Passport_RequestHeader(_ _0: String) -> (String, [(Int, NSRange)]) { - return formatWithArgumentRanges(self._s[1143]!, self._r[1143]!, [_0]) + return formatWithArgumentRanges(self._s[1138]!, self._r[1138]!, [_0]) } - public var Watch_MessageView_ViewOnPhone: String { return self._s[1145]! } - public var Privacy_Calls_CustomShareHelp: String { return self._s[1146]! } - public var ChangePhoneNumberNumber_Title: String { return self._s[1148]! } - public var State_ConnectingToProxyInfo: String { return self._s[1149]! } - public var Message_VideoMessage: String { return self._s[1151]! } - public var ChannelInfo_DeleteChannel: String { return self._s[1152]! } - public var ContactInfo_PhoneLabelOther: String { return self._s[1153]! } - public var Channel_EditAdmin_CannotEdit: String { return self._s[1154]! } - public var Passport_DeleteAddressConfirmation: String { return self._s[1155]! } - public var Activity_RecordingAudio: String { return self._s[1156]! } - public var PasscodeSettings_TryAgainIn1Minute: String { return self._s[1157]! } + public var Watch_MessageView_ViewOnPhone: String { return self._s[1140]! } + public var Privacy_Calls_CustomShareHelp: String { return self._s[1141]! } + public var ChangePhoneNumberNumber_Title: String { return self._s[1143]! } + public var State_ConnectingToProxyInfo: String { return self._s[1144]! } + public var Message_VideoMessage: String { return self._s[1146]! } + public var ChannelInfo_DeleteChannel: String { return self._s[1147]! } + public var ContactInfo_PhoneLabelOther: String { return self._s[1148]! } + public var Channel_EditAdmin_CannotEdit: String { return self._s[1149]! } + public var Passport_DeleteAddressConfirmation: String { return self._s[1150]! } + public var Activity_RecordingAudio: String { return self._s[1151]! } + public var PasscodeSettings_TryAgainIn1Minute: String { return self._s[1152]! } public func Notification_ChangedGroupName(_ _0: String, _ _1: String) -> (String, [(Int, NSRange)]) { - return formatWithArgumentRanges(self._s[1159]!, self._r[1159]!, [_0, _1]) + return formatWithArgumentRanges(self._s[1154]!, self._r[1154]!, [_0, _1]) } - public var Conversation_ApplyLocalization: String { return self._s[1162]! } - public var UserInfo_AddPhone: String { return self._s[1163]! } - public var Map_ShareLiveLocationHelp: String { return self._s[1164]! } + public var Conversation_ApplyLocalization: String { return self._s[1157]! } + public var UserInfo_AddPhone: String { return self._s[1158]! } + public var Map_ShareLiveLocationHelp: String { return self._s[1159]! } public func Passport_Identity_NativeNameGenericHelp(_ _0: String) -> (String, [(Int, NSRange)]) { - return formatWithArgumentRanges(self._s[1165]!, self._r[1165]!, [_0]) + return formatWithArgumentRanges(self._s[1160]!, self._r[1160]!, [_0]) } - public var Passport_Scans: String { return self._s[1167]! } - public var BlockedUsers_Unblock: String { return self._s[1168]! } - public var Channel_Management_LabelCreator: String { return self._s[1169]! } - public var Passport_Identity_NativeNameGenericTitle: String { return self._s[1170]! } + public var Passport_Scans: String { return self._s[1162]! } + public var BlockedUsers_Unblock: String { return self._s[1163]! } + public var Channel_Management_LabelCreator: String { return self._s[1164]! } + public var Passport_Identity_NativeNameGenericTitle: String { return self._s[1165]! } public func Login_EmailPhoneBody(_ _0: String, _ _1: String, _ _2: String) -> (String, [(Int, NSRange)]) { - return formatWithArgumentRanges(self._s[1171]!, self._r[1171]!, [_0, _1, _2]) + return formatWithArgumentRanges(self._s[1166]!, self._r[1166]!, [_0, _1, _2]) } - public var Login_PhoneNumberHelp: String { return self._s[1172]! } - public var LastSeen_ALongTimeAgo: String { return self._s[1173]! } - public var Channel_AdminLog_CanPinMessages: String { return self._s[1174]! } - public var ChannelIntro_CreateChannel: String { return self._s[1175]! } - public var Conversation_UnreadMessages: String { return self._s[1176]! } - public var Channel_AdminLog_EmptyText: String { return self._s[1177]! } - public var Notification_GroupActivated: String { return self._s[1178]! } + public var Login_PhoneNumberHelp: String { return self._s[1167]! } + public var LastSeen_ALongTimeAgo: String { return self._s[1168]! } + public var Channel_AdminLog_CanPinMessages: String { return self._s[1169]! } + public var ChannelIntro_CreateChannel: String { return self._s[1170]! } + public var Conversation_UnreadMessages: String { return self._s[1171]! } + public var Channel_AdminLog_EmptyText: String { return self._s[1172]! } + public var Notification_GroupActivated: String { return self._s[1173]! } public func Notification_PinnedContactMessage(_ _0: String) -> (String, [(Int, NSRange)]) { - return formatWithArgumentRanges(self._s[1179]!, self._r[1179]!, [_0]) + return formatWithArgumentRanges(self._s[1174]!, self._r[1174]!, [_0]) } public func DownloadingStatus(_ _0: String, _ _1: String) -> (String, [(Int, NSRange)]) { - return formatWithArgumentRanges(self._s[1180]!, self._r[1180]!, [_0, _1]) + return formatWithArgumentRanges(self._s[1175]!, self._r[1175]!, [_0, _1]) } - public var GroupInfo_ConvertToSupergroup: String { return self._s[1182]! } + public var GroupInfo_ConvertToSupergroup: String { return self._s[1177]! } public func PrivacyPolicy_AgeVerificationMessage(_ _0: String) -> (String, [(Int, NSRange)]) { - return formatWithArgumentRanges(self._s[1183]!, self._r[1183]!, [_0]) + return formatWithArgumentRanges(self._s[1178]!, self._r[1178]!, [_0]) } - public var Document_TargetConfirmationFormat: String { return self._s[1184]! } + public var Document_TargetConfirmationFormat: String { return self._s[1179]! } public func Call_StatusOngoing(_ _0: String) -> (String, [(Int, NSRange)]) { - return formatWithArgumentRanges(self._s[1185]!, self._r[1185]!, [_0]) + return formatWithArgumentRanges(self._s[1180]!, self._r[1180]!, [_0]) } public func CHAT_MESSAGE_INVOICE(_ _1: String, _ _2: String, _ _3: String) -> (String, [(Int, NSRange)]) { - return formatWithArgumentRanges(self._s[1187]!, self._r[1187]!, [_1, _2, _3]) + return formatWithArgumentRanges(self._s[1182]!, self._r[1182]!, [_1, _2, _3]) } - public var Conversation_ClearSelfHistory: String { return self._s[1188]! } - public var Checkout_NewCard_PostcodePlaceholder: String { return self._s[1189]! } - public var Stickers_SuggestNone: String { return self._s[1190]! } - public var Settings_SaveIncomingPhotos: String { return self._s[1191]! } - public var Media_ShareThisPhoto: String { return self._s[1192]! } - public var InfoPlist_NSContactsUsageDescription: String { return self._s[1193]! } - public var Conversation_ContextMenuCopyLink: String { return self._s[1194]! } - public var PrivacyPolicy_AgeVerificationTitle: String { return self._s[1195]! } - public var TwoStepAuth_SetupPasswordEnterPasswordNew: String { return self._s[1196]! } - public var Map_OpenIn: String { return self._s[1197]! } + public var Conversation_ClearSelfHistory: String { return self._s[1183]! } + public var Checkout_NewCard_PostcodePlaceholder: String { return self._s[1184]! } + public var Stickers_SuggestNone: String { return self._s[1185]! } + public var Settings_SaveIncomingPhotos: String { return self._s[1186]! } + public var Media_ShareThisPhoto: String { return self._s[1187]! } + public var InfoPlist_NSContactsUsageDescription: String { return self._s[1188]! } + public var Conversation_ContextMenuCopyLink: String { return self._s[1189]! } + public var PrivacyPolicy_AgeVerificationTitle: String { return self._s[1190]! } + public var TwoStepAuth_SetupPasswordEnterPasswordNew: String { return self._s[1191]! } + public var Permissions_CellularDataTitle_v0: String { return self._s[1192]! } + public var Map_OpenIn: String { return self._s[1193]! } public func ChannelInfo_AddParticipantConfirmation(_ _0: String) -> (String, [(Int, NSRange)]) { - return formatWithArgumentRanges(self._s[1200]!, self._r[1200]!, [_0]) + return formatWithArgumentRanges(self._s[1196]!, self._r[1196]!, [_0]) } - public var Passport_Identity_MiddleNamePlaceholder: String { return self._s[1202]! } - public var UserInfo_FirstNamePlaceholder: String { return self._s[1203]! } - public var PrivacyLastSeenSettings_WhoCanSeeMyTimestamp: String { return self._s[1204]! } - public var Login_SelectCountry_Title: String { return self._s[1205]! } - public var Channel_EditAdmin_PermissionBanUsers: String { return self._s[1206]! } - public var Watch_Suggestion_BRB: String { return self._s[1207]! } - public var Contacts_PermissionsTitle: String { return self._s[1208]! } - public var Passport_Identity_EditIdentityCard: String { return self._s[1209]! } - public var Conversation_RestrictedInline: String { return self._s[1210]! } - public var StickerPack_ViewPack: String { return self._s[1212]! } + public var Passport_Identity_MiddleNamePlaceholder: String { return self._s[1198]! } + public var UserInfo_FirstNamePlaceholder: String { return self._s[1199]! } + public var PrivacyLastSeenSettings_WhoCanSeeMyTimestamp: String { return self._s[1200]! } + public var Login_SelectCountry_Title: String { return self._s[1201]! } + public var Channel_EditAdmin_PermissionBanUsers: String { return self._s[1202]! } + public var Watch_Suggestion_BRB: String { return self._s[1203]! } + public var Contacts_PermissionsTitle: String { return self._s[1204]! } + public var Passport_Identity_EditIdentityCard: String { return self._s[1205]! } + public var Conversation_RestrictedInline: String { return self._s[1206]! } + public var StickerPack_ViewPack: String { return self._s[1208]! } public func Update_AppVersion(_ _0: String) -> (String, [(Int, NSRange)]) { - return formatWithArgumentRanges(self._s[1213]!, self._r[1213]!, [_0]) + return formatWithArgumentRanges(self._s[1209]!, self._r[1209]!, [_0]) } - public var Compose_NewChannel: String { return self._s[1215]! } - public var Channel_Info_Stickers: String { return self._s[1219]! } - public var AutoNightTheme_PreferredTheme: String { return self._s[1220]! } - public var PrivacyPolicy_AgeVerificationAgree: String { return self._s[1221]! } - public var Passport_DeletePersonalDetails: String { return self._s[1222]! } - public var Conversation_SearchNoResults: String { return self._s[1224]! } - public var Channel_Members_AddAdminErrorNotAMember: String { return self._s[1225]! } - public var Login_Code: String { return self._s[1226]! } - public var Watch_Suggestion_WhatsUp: String { return self._s[1227]! } - public var Weekday_ShortThursday: String { return self._s[1228]! } - public var Resolve_ErrorNotFound: String { return self._s[1229]! } - public var LastSeen_Offline: String { return self._s[1230]! } - public var Privacy_Calls_AlwaysAllow_Title: String { return self._s[1231]! } - public var Channel_AdminLog_CanChangeInviteLink: String { return self._s[1232]! } - public var GroupInfo_Title: String { return self._s[1233]! } - public var NotificationsSound_Note: String { return self._s[1234]! } - public var Conversation_EditingMessagePanelTitle: String { return self._s[1235]! } - public var Privacy_Calls: String { return self._s[1236]! } - public var Month_ShortAugust: String { return self._s[1237]! } - public var TwoStepAuth_SetPasswordHelp: String { return self._s[1238]! } - public var Notifications_Reset: String { return self._s[1239]! } - public var Conversation_Pin: String { return self._s[1240]! } - public var Passport_Language_lv: String { return self._s[1241]! } - public var BlockedUsers_Info: String { return self._s[1242]! } - public var Watch_Conversation_Unblock: String { return self._s[1245]! } + public var Compose_NewChannel: String { return self._s[1211]! } + public var Channel_Info_Stickers: String { return self._s[1215]! } + public var AutoNightTheme_PreferredTheme: String { return self._s[1216]! } + public var PrivacyPolicy_AgeVerificationAgree: String { return self._s[1217]! } + public var Passport_DeletePersonalDetails: String { return self._s[1218]! } + public var Conversation_SearchNoResults: String { return self._s[1220]! } + public var Channel_Members_AddAdminErrorNotAMember: String { return self._s[1221]! } + public var Login_Code: String { return self._s[1222]! } + public var Watch_Suggestion_WhatsUp: String { return self._s[1223]! } + public var Weekday_ShortThursday: String { return self._s[1224]! } + public var Resolve_ErrorNotFound: String { return self._s[1225]! } + public var LastSeen_Offline: String { return self._s[1226]! } + public var Privacy_Calls_AlwaysAllow_Title: String { return self._s[1227]! } + public var Channel_AdminLog_CanChangeInviteLink: String { return self._s[1228]! } + public var GroupInfo_Title: String { return self._s[1229]! } + public var NotificationsSound_Note: String { return self._s[1230]! } + public var Conversation_EditingMessagePanelTitle: String { return self._s[1231]! } + public var Privacy_Calls: String { return self._s[1232]! } + public var Month_ShortAugust: String { return self._s[1233]! } + public var TwoStepAuth_SetPasswordHelp: String { return self._s[1234]! } + public var Notifications_Reset: String { return self._s[1235]! } + public var Conversation_Pin: String { return self._s[1236]! } + public var Passport_Language_lv: String { return self._s[1237]! } + public var BlockedUsers_Info: String { return self._s[1238]! } + public var Watch_Conversation_Unblock: String { return self._s[1241]! } public func Time_MonthOfYear_m9(_ _0: String) -> (String, [(Int, NSRange)]) { + return formatWithArgumentRanges(self._s[1242]!, self._r[1242]!, [_0]) + } + public var CloudStorage_Title: String { return self._s[1243]! } + public var GroupInfo_DeleteAndExitConfirmation: String { return self._s[1244]! } + public var TwoStepAuth_RecoveryEmailTitle: String { return self._s[1245]! } + public func NetworkUsageSettings_WifiUsageSince(_ _0: String) -> (String, [(Int, NSRange)]) { return formatWithArgumentRanges(self._s[1246]!, self._r[1246]!, [_0]) } - public var CloudStorage_Title: String { return self._s[1247]! } - public var GroupInfo_DeleteAndExitConfirmation: String { return self._s[1248]! } - public var TwoStepAuth_RecoveryEmailTitle: String { return self._s[1249]! } - public func NetworkUsageSettings_WifiUsageSince(_ _0: String) -> (String, [(Int, NSRange)]) { - return formatWithArgumentRanges(self._s[1250]!, self._r[1250]!, [_0]) - } - public var Watch_Suggestion_OnMyWay: String { return self._s[1251]! } - public var Channel_AdminLogFilter_AdminsTitle: String { return self._s[1252]! } - public var Passport_Address_EditBankStatement: String { return self._s[1253]! } - public var ShareMenu_Comment: String { return self._s[1254]! } - public var Notifications_PermissionsTitle: String { return self._s[1255]! } - public var Settings_Support: String { return self._s[1256]! } - public var Notifications_ChannelNotificationsSound: String { return self._s[1257]! } - public var Channel_AdminLog_BanSendGifs: String { return self._s[1258]! } - public var Watch_Stickers_StickerPacks: String { return self._s[1259]! } - public var Common_Select: String { return self._s[1261]! } - public var CheckoutInfo_ErrorEmailInvalid: String { return self._s[1262]! } - public var ChatAdmins_AllMembersAreAdminsOffHelp: String { return self._s[1264]! } - public var PasscodeSettings_AutoLock_IfAwayFor_5hours: String { return self._s[1265]! } - public var Appearance_PreviewReplyAuthor: String { return self._s[1266]! } - public var TwoStepAuth_RecoveryTitle: String { return self._s[1267]! } - public var Widget_AuthRequired: String { return self._s[1268]! } - public var Camera_FlashOn: String { return self._s[1269]! } - public var Channel_Stickers_NotFoundHelp: String { return self._s[1270]! } - public var Watch_Suggestion_OK: String { return self._s[1271]! } + public var Watch_Suggestion_OnMyWay: String { return self._s[1247]! } + public var Channel_AdminLogFilter_AdminsTitle: String { return self._s[1248]! } + public var Passport_Address_EditBankStatement: String { return self._s[1249]! } + public var ShareMenu_Comment: String { return self._s[1250]! } + public var Permissions_ContactsTitle_v0: String { return self._s[1251]! } + public var Notifications_PermissionsTitle: String { return self._s[1252]! } + public var Settings_Support: String { return self._s[1253]! } + public var Notifications_ChannelNotificationsSound: String { return self._s[1254]! } + public var Channel_AdminLog_BanSendGifs: String { return self._s[1255]! } + public var Watch_Stickers_StickerPacks: String { return self._s[1256]! } + public var Common_Select: String { return self._s[1258]! } + public var CheckoutInfo_ErrorEmailInvalid: String { return self._s[1259]! } + public var ChatAdmins_AllMembersAreAdminsOffHelp: String { return self._s[1261]! } + public var PasscodeSettings_AutoLock_IfAwayFor_5hours: String { return self._s[1262]! } + public var Appearance_PreviewReplyAuthor: String { return self._s[1263]! } + public var TwoStepAuth_RecoveryTitle: String { return self._s[1264]! } + public var Widget_AuthRequired: String { return self._s[1265]! } + public var Camera_FlashOn: String { return self._s[1266]! } + public var Channel_Stickers_NotFoundHelp: String { return self._s[1267]! } + public var Watch_Suggestion_OK: String { return self._s[1268]! } public func Username_LinkHint(_ _0: String) -> (String, [(Int, NSRange)]) { - return formatWithArgumentRanges(self._s[1273]!, self._r[1273]!, [_0]) + return formatWithArgumentRanges(self._s[1270]!, self._r[1270]!, [_0]) } public func Notification_PinnedLiveLocationMessage(_ _0: String) -> (String, [(Int, NSRange)]) { - return formatWithArgumentRanges(self._s[1274]!, self._r[1274]!, [_0]) + return formatWithArgumentRanges(self._s[1271]!, self._r[1271]!, [_0]) } - public var DialogList_AdLabel: String { return self._s[1275]! } - public var WatchRemote_NotificationText: String { return self._s[1276]! } - public var Conversation_ReportSpam: String { return self._s[1277]! } - public var Settings_LogoutConfirmationTitle: String { return self._s[1279]! } - public var PhoneLabel_Title: String { return self._s[1280]! } - public var Passport_Address_EditRentalAgreement: String { return self._s[1281]! } - public var Notifications_ExceptionsTitle: String { return self._s[1282]! } + public var DialogList_AdLabel: String { return self._s[1272]! } + public var WatchRemote_NotificationText: String { return self._s[1273]! } + public var Conversation_ReportSpam: String { return self._s[1274]! } + public var Settings_LogoutConfirmationTitle: String { return self._s[1276]! } + public var PhoneLabel_Title: String { return self._s[1277]! } + public var Passport_Address_EditRentalAgreement: String { return self._s[1278]! } + public var Notifications_ExceptionsTitle: String { return self._s[1279]! } public func CHANNEL_MESSAGE_PHOTO(_ _1: String) -> (String, [(Int, NSRange)]) { - return formatWithArgumentRanges(self._s[1283]!, self._r[1283]!, [_1]) + return formatWithArgumentRanges(self._s[1280]!, self._r[1280]!, [_1]) } - public var Notifications_AlertTones: String { return self._s[1284]! } - public var Call_ReportIncludeLogDescription: String { return self._s[1285]! } + public var Notifications_AlertTones: String { return self._s[1281]! } + public var Call_ReportIncludeLogDescription: String { return self._s[1282]! } public func CHAT_ADD_MEMBER(_ _1: String, _ _2: String, _ _3: String) -> (String, [(Int, NSRange)]) { - return formatWithArgumentRanges(self._s[1286]!, self._r[1286]!, [_1, _2, _3]) + return formatWithArgumentRanges(self._s[1283]!, self._r[1283]!, [_1, _2, _3]) } - public var AutoDownloadSettings_PrivateChats: String { return self._s[1287]! } - public var TwoStepAuth_AddHintTitle: String { return self._s[1289]! } - public var ReportPeer_ReasonOther: String { return self._s[1290]! } - public var KeyCommand_ScrollDown: String { return self._s[1292]! } + public var AutoDownloadSettings_PrivateChats: String { return self._s[1284]! } + public var TwoStepAuth_AddHintTitle: String { return self._s[1286]! } + public var ReportPeer_ReasonOther: String { return self._s[1287]! } + public var KeyCommand_ScrollDown: String { return self._s[1289]! } public func Login_BannedPhoneSubject(_ _0: String) -> (String, [(Int, NSRange)]) { - return formatWithArgumentRanges(self._s[1293]!, self._r[1293]!, [_0]) + return formatWithArgumentRanges(self._s[1290]!, self._r[1290]!, [_0]) } - public var NetworkUsageSettings_MediaVideoDataSection: String { return self._s[1294]! } - public var ChannelInfo_DeleteGroupConfirmation: String { return self._s[1295]! } - public var AuthSessions_LogOut: String { return self._s[1296]! } - public var Passport_Identity_TypeInternalPassport: String { return self._s[1297]! } - public var ChatSettings_AutoDownloadVoiceMessages: String { return self._s[1298]! } + public var NetworkUsageSettings_MediaVideoDataSection: String { return self._s[1291]! } + public var ChannelInfo_DeleteGroupConfirmation: String { return self._s[1292]! } + public var AuthSessions_LogOut: String { return self._s[1293]! } + public var Passport_Identity_TypeInternalPassport: String { return self._s[1294]! } + public var ChatSettings_AutoDownloadVoiceMessages: String { return self._s[1295]! } public func CHAT_MESSAGE_DOC(_ _1: String, _ _2: String) -> (String, [(Int, NSRange)]) { - return formatWithArgumentRanges(self._s[1299]!, self._r[1299]!, [_1, _2]) + return formatWithArgumentRanges(self._s[1296]!, self._r[1296]!, [_1, _2]) } - public var Passport_Phone_Title: String { return self._s[1300]! } - public var Settings_PhoneNumber: String { return self._s[1301]! } - public var NotificationsSound_Alert: String { return self._s[1302]! } - public var PhotoEditor_CurvesTool: String { return self._s[1304]! } - public var Checkout_PaymentMethod: String { return self._s[1306]! } - public var Contacts_AccessDeniedError: String { return self._s[1307]! } - public var Camera_PhotoMode: String { return self._s[1310]! } - public var Passport_Address_AddUtilityBill: String { return self._s[1311]! } - public var CallSettings_OnMobile: String { return self._s[1312]! } - public var Tour_Text2: String { return self._s[1313]! } - public var Permissions_Skip: String { return self._s[1315]! } - public var DialogList_EncryptionProcessing: String { return self._s[1316]! } - public var SecretImage_Title: String { return self._s[1317]! } - public var Watch_MessageView_Title: String { return self._s[1318]! } + public var Passport_Phone_Title: String { return self._s[1297]! } + public var Settings_PhoneNumber: String { return self._s[1298]! } + public var NotificationsSound_Alert: String { return self._s[1299]! } + public var PhotoEditor_CurvesTool: String { return self._s[1301]! } + public var Checkout_PaymentMethod: String { return self._s[1303]! } + public var Contacts_AccessDeniedError: String { return self._s[1304]! } + public var Camera_PhotoMode: String { return self._s[1307]! } + public var Passport_Address_AddUtilityBill: String { return self._s[1308]! } + public var CallSettings_OnMobile: String { return self._s[1309]! } + public var Tour_Text2: String { return self._s[1310]! } + public var Permissions_Skip: String { return self._s[1312]! } + public var DialogList_EncryptionProcessing: String { return self._s[1313]! } + public var SecretImage_Title: String { return self._s[1314]! } + public var Watch_MessageView_Title: String { return self._s[1315]! } public func Notification_GroupInviter(_ _0: String) -> (String, [(Int, NSRange)]) { - return formatWithArgumentRanges(self._s[1319]!, self._r[1319]!, [_0]) + return formatWithArgumentRanges(self._s[1316]!, self._r[1316]!, [_0]) } - public var Notification_CallCanceled: String { return self._s[1320]! } - public var Privacy_PaymentsClear_PaymentInfo: String { return self._s[1321]! } + public var Notification_CallCanceled: String { return self._s[1317]! } + public var Privacy_PaymentsClear_PaymentInfo: String { return self._s[1318]! } public func MESSAGE_SCREENSHOT(_ _1: String) -> (String, [(Int, NSRange)]) { - return formatWithArgumentRanges(self._s[1322]!, self._r[1322]!, [_1]) + return formatWithArgumentRanges(self._s[1319]!, self._r[1319]!, [_1]) } - public var Settings_ProxyConnecting: String { return self._s[1323]! } - public var Profile_MessageLifetime5s: String { return self._s[1325]! } - public var Username_InvalidCharacters: String { return self._s[1326]! } - public var AutoDownloadSettings_LimitBySize: String { return self._s[1327]! } - public var Notification_CreatedChannel: String { return self._s[1329]! } - public var Passcode_AppLockedAlert: String { return self._s[1331]! } - public var Contacts_TopSection: String { return self._s[1332]! } + public var Settings_ProxyConnecting: String { return self._s[1320]! } + public var Profile_MessageLifetime5s: String { return self._s[1322]! } + public var Username_InvalidCharacters: String { return self._s[1323]! } + public var AutoDownloadSettings_LimitBySize: String { return self._s[1324]! } + public var Notification_CreatedChannel: String { return self._s[1326]! } + public var Passcode_AppLockedAlert: String { return self._s[1328]! } + public var Contacts_TopSection: String { return self._s[1329]! } public func Time_MonthOfYear_m6(_ _0: String) -> (String, [(Int, NSRange)]) { - return formatWithArgumentRanges(self._s[1333]!, self._r[1333]!, [_0]) + return formatWithArgumentRanges(self._s[1330]!, self._r[1330]!, [_0]) } - public var ReportPeer_ReasonSpam: String { return self._s[1334]! } - public var UserInfo_TapToCall: String { return self._s[1335]! } - public var Common_Search: String { return self._s[1337]! } - public var AuthSessions_IncompleteAttemptsInfo: String { return self._s[1338]! } - public var Message_InvoiceLabel: String { return self._s[1339]! } - public var Conversation_InputTextPlaceholder: String { return self._s[1340]! } - public var NetworkUsageSettings_MediaImageDataSection: String { return self._s[1341]! } + public var ReportPeer_ReasonSpam: String { return self._s[1331]! } + public var UserInfo_TapToCall: String { return self._s[1332]! } + public var Common_Search: String { return self._s[1334]! } + public var AuthSessions_IncompleteAttemptsInfo: String { return self._s[1335]! } + public var Message_InvoiceLabel: String { return self._s[1336]! } + public var Conversation_InputTextPlaceholder: String { return self._s[1337]! } + public var NetworkUsageSettings_MediaImageDataSection: String { return self._s[1338]! } public func Passport_Address_UploadOneOfScan(_ _0: String) -> (String, [(Int, NSRange)]) { - return formatWithArgumentRanges(self._s[1342]!, self._r[1342]!, [_0]) + return formatWithArgumentRanges(self._s[1339]!, self._r[1339]!, [_0]) } public func MESSAGE_DOC(_ _1: String) -> (String, [(Int, NSRange)]) { - return formatWithArgumentRanges(self._s[1343]!, self._r[1343]!, [_1]) + return formatWithArgumentRanges(self._s[1340]!, self._r[1340]!, [_1]) } - public var Conversation_Info: String { return self._s[1344]! } - public var Login_InfoDeletePhoto: String { return self._s[1345]! } - public var Passport_Language_vi: String { return self._s[1347]! } - public var Conversation_Search: String { return self._s[1348]! } - public var DialogList_DeleteBotConversationConfirmation: String { return self._s[1349]! } - public var ReportPeer_ReasonPornography: String { return self._s[1350]! } - public var AutoDownloadSettings_PhotosTitle: String { return self._s[1351]! } - public var Conversation_SendMessageErrorGroupRestricted: String { return self._s[1352]! } - public var Map_LiveLocationGroupDescription: String { return self._s[1353]! } - public var Channel_Setup_TypeHeader: String { return self._s[1354]! } - public var AuthSessions_LoggedIn: String { return self._s[1355]! } - public var Login_SmsRequestState3: String { return self._s[1356]! } - public var Passport_Address_EditUtilityBill: String { return self._s[1357]! } - public var Appearance_ReduceMotionInfo: String { return self._s[1358]! } - public var Channel_Edit_LinkItem: String { return self._s[1359]! } - public var Privacy_Calls_P2PNever: String { return self._s[1360]! } - public var Conversation_AddToReadingList: String { return self._s[1362]! } + public var Conversation_Info: String { return self._s[1341]! } + public var Login_InfoDeletePhoto: String { return self._s[1342]! } + public var Passport_Language_vi: String { return self._s[1344]! } + public var Conversation_Search: String { return self._s[1345]! } + public var DialogList_DeleteBotConversationConfirmation: String { return self._s[1346]! } + public var ReportPeer_ReasonPornography: String { return self._s[1347]! } + public var AutoDownloadSettings_PhotosTitle: String { return self._s[1348]! } + public var Conversation_SendMessageErrorGroupRestricted: String { return self._s[1349]! } + public var Map_LiveLocationGroupDescription: String { return self._s[1350]! } + public var Channel_Setup_TypeHeader: String { return self._s[1351]! } + public var AuthSessions_LoggedIn: String { return self._s[1352]! } + public var Login_SmsRequestState3: String { return self._s[1353]! } + public var Passport_Address_EditUtilityBill: String { return self._s[1354]! } + public var Appearance_ReduceMotionInfo: String { return self._s[1355]! } + public var Channel_Edit_LinkItem: String { return self._s[1356]! } + public var Privacy_Calls_P2PNever: String { return self._s[1357]! } + public var Conversation_AddToReadingList: String { return self._s[1359]! } public func MESSAGE_GEO(_ _1: String) -> (String, [(Int, NSRange)]) { - return formatWithArgumentRanges(self._s[1363]!, self._r[1363]!, [_1]) + return formatWithArgumentRanges(self._s[1360]!, self._r[1360]!, [_1]) } - public var Message_Animation: String { return self._s[1364]! } - public var Map_Unknown: String { return self._s[1365]! } - public var Call_StatusRequesting: String { return self._s[1366]! } + public var Message_Animation: String { return self._s[1361]! } + public var Map_Unknown: String { return self._s[1362]! } + public var Call_StatusRequesting: String { return self._s[1363]! } public func Passport_FieldOneOf_Or(_ _1: String, _ _2: String) -> (String, [(Int, NSRange)]) { - return formatWithArgumentRanges(self._s[1367]!, self._r[1367]!, [_1, _2]) + return formatWithArgumentRanges(self._s[1364]!, self._r[1364]!, [_1, _2]) } - public var Conversation_SecretChatContextBotAlert: String { return self._s[1368]! } - public var SocksProxySetup_ProxyStatusChecking: String { return self._s[1369]! } + public var Conversation_SecretChatContextBotAlert: String { return self._s[1365]! } + public var SocksProxySetup_ProxyStatusChecking: String { return self._s[1366]! } public func MESSAGE_PHOTO_SECRET(_ _1: String) -> (String, [(Int, NSRange)]) { - return formatWithArgumentRanges(self._s[1370]!, self._r[1370]!, [_1]) + return formatWithArgumentRanges(self._s[1367]!, self._r[1367]!, [_1]) } - public var Weekday_Monday: String { return self._s[1371]! } - public var Update_Skip: String { return self._s[1372]! } - public var Group_Username_RemoveExistingUsernamesInfo: String { return self._s[1373]! } - public var Permissions_SiriTitle: String { return self._s[1374]! } - public var BlockedUsers_Title: String { return self._s[1375]! } + public var Weekday_Monday: String { return self._s[1368]! } + public var Update_Skip: String { return self._s[1369]! } + public var Group_Username_RemoveExistingUsernamesInfo: String { return self._s[1370]! } + public var BlockedUsers_Title: String { return self._s[1371]! } public func Notification_PinnedLocationMessage(_ _0: String) -> (String, [(Int, NSRange)]) { - return formatWithArgumentRanges(self._s[1376]!, self._r[1376]!, [_0]) + return formatWithArgumentRanges(self._s[1372]!, self._r[1372]!, [_0]) } - public var Username_CheckingUsername: String { return self._s[1377]! } - public var NotificationsSound_Bell: String { return self._s[1378]! } - public var Conversation_SendMessageErrorFlood: String { return self._s[1379]! } - public var ChannelMembers_ChannelAdminsTitle: String { return self._s[1380]! } - public var ChatSettings_Groups: String { return self._s[1381]! } - public var Your_card_was_declined: String { return self._s[1382]! } - public var TwoStepAuth_EnterPasswordHelp: String { return self._s[1384]! } + public var Username_CheckingUsername: String { return self._s[1373]! } + public var NotificationsSound_Bell: String { return self._s[1374]! } + public var Conversation_SendMessageErrorFlood: String { return self._s[1375]! } + public var ChannelMembers_ChannelAdminsTitle: String { return self._s[1376]! } + public var ChatSettings_Groups: String { return self._s[1377]! } + public var Your_card_was_declined: String { return self._s[1378]! } + public var TwoStepAuth_EnterPasswordHelp: String { return self._s[1380]! } public func PINNED_GEO(_ _1: String) -> (String, [(Int, NSRange)]) { - return formatWithArgumentRanges(self._s[1385]!, self._r[1385]!, [_1]) + return formatWithArgumentRanges(self._s[1381]!, self._r[1381]!, [_1]) } - public var Permissions_CellularDataTitle: String { return self._s[1386]! } - public var PhotoEditor_CurvesAll: String { return self._s[1387]! } - public var Weekday_ShortTuesday: String { return self._s[1388]! } - public var DialogList_Read: String { return self._s[1389]! } + public var PhotoEditor_CurvesAll: String { return self._s[1382]! } + public var Weekday_ShortTuesday: String { return self._s[1383]! } + public var DialogList_Read: String { return self._s[1384]! } public func PINNED_TEXT(_ _1: String, _ _2: String) -> (String, [(Int, NSRange)]) { - return formatWithArgumentRanges(self._s[1390]!, self._r[1390]!, [_1, _2]) + return formatWithArgumentRanges(self._s[1385]!, self._r[1385]!, [_1, _2]) } - public var ChannelMembers_WhoCanAddMembers_AllMembers: String { return self._s[1391]! } - public var Passport_Identity_Gender: String { return self._s[1392]! } + public var ChannelMembers_WhoCanAddMembers_AllMembers: String { return self._s[1386]! } + public var Passport_Identity_Gender: String { return self._s[1387]! } public func Target_ShareGameConfirmationPrivate(_ _0: String) -> (String, [(Int, NSRange)]) { - return formatWithArgumentRanges(self._s[1393]!, self._r[1393]!, [_0]) + return formatWithArgumentRanges(self._s[1388]!, self._r[1388]!, [_0]) } - public var Target_SelectGroup: String { return self._s[1394]! } + public var Target_SelectGroup: String { return self._s[1389]! } public func DialogList_EncryptedChatStartedIncoming(_ _0: String) -> (String, [(Int, NSRange)]) { - return formatWithArgumentRanges(self._s[1396]!, self._r[1396]!, [_0]) + return formatWithArgumentRanges(self._s[1391]!, self._r[1391]!, [_0]) } - public var Passport_Language_en: String { return self._s[1397]! } - public var Channel_Username_CreatePublicLinkHelp: String { return self._s[1398]! } - public var Login_CancelPhoneVerificationContinue: String { return self._s[1399]! } + public var Passport_Language_en: String { return self._s[1392]! } + public var Channel_Username_CreatePublicLinkHelp: String { return self._s[1393]! } + public var Login_CancelPhoneVerificationContinue: String { return self._s[1394]! } public func AUTH_REGION(_ _1: String, _ _2: String) -> (String, [(Int, NSRange)]) { - return formatWithArgumentRanges(self._s[1400]!, self._r[1400]!, [_1, _2]) + return formatWithArgumentRanges(self._s[1395]!, self._r[1395]!, [_1, _2]) } - public var Checkout_NewCard_PaymentCard: String { return self._s[1402]! } - public var Login_InfoHelp: String { return self._s[1403]! } - public var SocksProxySetup_AddProxy: String { return self._s[1406]! } - public var PasscodeSettings_SimplePasscodeHelp: String { return self._s[1407]! } - public var UserInfo_GroupsInCommon: String { return self._s[1408]! } - public var Call_AudioRouteHide: String { return self._s[1409]! } - public var ContactInfo_PhoneLabelMobile: String { return self._s[1411]! } - public var TextFormat_Bold: String { return self._s[1412]! } - public var FastTwoStepSetup_EmailSection: String { return self._s[1413]! } - public var Notifications_Title: String { return self._s[1414]! } - public var Group_Username_InvalidTooShort: String { return self._s[1415]! } - public var Channel_ErrorAddTooMuch: String { return self._s[1416]! } + public var Checkout_NewCard_PaymentCard: String { return self._s[1397]! } + public var Login_InfoHelp: String { return self._s[1398]! } + public var SocksProxySetup_AddProxy: String { return self._s[1401]! } + public var PasscodeSettings_SimplePasscodeHelp: String { return self._s[1402]! } + public var UserInfo_GroupsInCommon: String { return self._s[1403]! } + public var Call_AudioRouteHide: String { return self._s[1404]! } + public var ContactInfo_PhoneLabelMobile: String { return self._s[1406]! } + public var TextFormat_Bold: String { return self._s[1407]! } + public var FastTwoStepSetup_EmailSection: String { return self._s[1408]! } + public var Notifications_Title: String { return self._s[1409]! } + public var Group_Username_InvalidTooShort: String { return self._s[1410]! } + public var Channel_ErrorAddTooMuch: String { return self._s[1411]! } public func DialogList_MultipleTypingSuffix(_ _0: Int) -> (String, [(Int, NSRange)]) { - return formatWithArgumentRanges(self._s[1417]!, self._r[1417]!, ["\(_0)"]) + return formatWithArgumentRanges(self._s[1412]!, self._r[1412]!, ["\(_0)"]) } - public var Stickers_SuggestAdded: String { return self._s[1419]! } - public var Login_CountryCode: String { return self._s[1420]! } - public var Map_GetDirections: String { return self._s[1421]! } - public var Login_PhoneFloodError: String { return self._s[1422]! } + public var Stickers_SuggestAdded: String { return self._s[1414]! } + public var Login_CountryCode: String { return self._s[1415]! } + public var Map_GetDirections: String { return self._s[1416]! } + public var Login_PhoneFloodError: String { return self._s[1417]! } public func Time_MonthOfYear_m3(_ _0: String) -> (String, [(Int, NSRange)]) { + return formatWithArgumentRanges(self._s[1418]!, self._r[1418]!, [_0]) + } + public var Settings_SetUsername: String { return self._s[1420]! } + public var Notification_GroupInviterSelf: String { return self._s[1421]! } + public var InstantPage_TapToOpenLink: String { return self._s[1422]! } + public func Notification_ChannelInviter(_ _0: String) -> (String, [(Int, NSRange)]) { return formatWithArgumentRanges(self._s[1423]!, self._r[1423]!, [_0]) } - public var Settings_SetUsername: String { return self._s[1425]! } - public var Notification_GroupInviterSelf: String { return self._s[1426]! } - public var InstantPage_TapToOpenLink: String { return self._s[1427]! } - public func Notification_ChannelInviter(_ _0: String) -> (String, [(Int, NSRange)]) { - return formatWithArgumentRanges(self._s[1428]!, self._r[1428]!, [_0]) - } - public var Watch_Suggestion_TalkLater: String { return self._s[1429]! } - public var SecretChat_Title: String { return self._s[1430]! } - public var Group_UpgradeNoticeText1: String { return self._s[1431]! } - public var AuthSessions_Title: String { return self._s[1432]! } - public var PhotoEditor_CropAuto: String { return self._s[1433]! } - public var Channel_About_Title: String { return self._s[1434]! } - public var FastTwoStepSetup_EmailHelp: String { return self._s[1435]! } + public var Watch_Suggestion_TalkLater: String { return self._s[1424]! } + public var SecretChat_Title: String { return self._s[1425]! } + public var Group_UpgradeNoticeText1: String { return self._s[1426]! } + public var AuthSessions_Title: String { return self._s[1427]! } + public var PhotoEditor_CropAuto: String { return self._s[1428]! } + public var Channel_About_Title: String { return self._s[1429]! } + public var FastTwoStepSetup_EmailHelp: String { return self._s[1430]! } public func CHAT_ADD_YOU(_ _1: String, _ _2: String) -> (String, [(Int, NSRange)]) { - return formatWithArgumentRanges(self._s[1436]!, self._r[1436]!, [_1, _2]) + return formatWithArgumentRanges(self._s[1431]!, self._r[1431]!, [_1, _2]) } public func Conversation_Bytes(_ _0: Int) -> (String, [(Int, NSRange)]) { - return formatWithArgumentRanges(self._s[1437]!, self._r[1437]!, ["\(_0)"]) + return formatWithArgumentRanges(self._s[1432]!, self._r[1432]!, ["\(_0)"]) } - public var Conversation_PinMessageAlert_OnlyPin: String { return self._s[1440]! } - public var Group_Setup_HistoryVisibleHelp: String { return self._s[1441]! } + public var Conversation_PinMessageAlert_OnlyPin: String { return self._s[1435]! } + public var Group_Setup_HistoryVisibleHelp: String { return self._s[1436]! } public func TwoStepAuth_RecoveryEmailUnavailable(_ _0: String) -> (String, [(Int, NSRange)]) { - return formatWithArgumentRanges(self._s[1443]!, self._r[1443]!, [_0]) + return formatWithArgumentRanges(self._s[1438]!, self._r[1438]!, [_0]) } - public var Privacy_PaymentsClearInfoHelp: String { return self._s[1444]! } - public var Presence_online: String { return self._s[1446]! } - public var PasscodeSettings_Title: String { return self._s[1447]! } - public var Passport_Identity_ExpiryDatePlaceholder: String { return self._s[1448]! } - public var Web_OpenExternal: String { return self._s[1449]! } + public var Privacy_PaymentsClearInfoHelp: String { return self._s[1439]! } + public var Presence_online: String { return self._s[1441]! } + public var PasscodeSettings_Title: String { return self._s[1442]! } + public var Passport_Identity_ExpiryDatePlaceholder: String { return self._s[1443]! } + public var Web_OpenExternal: String { return self._s[1444]! } public func AutoNightTheme_AutomaticHelp(_ _0: String) -> (String, [(Int, NSRange)]) { - return formatWithArgumentRanges(self._s[1450]!, self._r[1450]!, [_0]) + return formatWithArgumentRanges(self._s[1445]!, self._r[1445]!, [_0]) } - public var FastTwoStepSetup_PasswordConfirmationPlaceholder: String { return self._s[1451]! } - public var Map_YouAreHere: String { return self._s[1452]! } + public var FastTwoStepSetup_PasswordConfirmationPlaceholder: String { return self._s[1446]! } + public var Map_YouAreHere: String { return self._s[1447]! } public func MESSAGE_GIF(_ _1: String) -> (String, [(Int, NSRange)]) { - return formatWithArgumentRanges(self._s[1453]!, self._r[1453]!, [_1]) + return formatWithArgumentRanges(self._s[1448]!, self._r[1448]!, [_1]) } public func AuthSessions_Message(_ _0: String) -> (String, [(Int, NSRange)]) { - return formatWithArgumentRanges(self._s[1454]!, self._r[1454]!, [_0]) + return formatWithArgumentRanges(self._s[1449]!, self._r[1449]!, [_0]) } - public var PrivacyLastSeenSettings_AlwaysShareWith: String { return self._s[1455]! } - public var Target_InviteToGroupErrorAlreadyInvited: String { return self._s[1456]! } + public var PrivacyLastSeenSettings_AlwaysShareWith: String { return self._s[1450]! } + public var Target_InviteToGroupErrorAlreadyInvited: String { return self._s[1451]! } public func AuthSessions_AppUnofficial(_ _0: String) -> (String, [(Int, NSRange)]) { - return formatWithArgumentRanges(self._s[1457]!, self._r[1457]!, [_0]) + return formatWithArgumentRanges(self._s[1452]!, self._r[1452]!, [_0]) } public func DialogList_LiveLocationSharingTo(_ _0: String) -> (String, [(Int, NSRange)]) { - return formatWithArgumentRanges(self._s[1458]!, self._r[1458]!, [_0]) + return formatWithArgumentRanges(self._s[1453]!, self._r[1453]!, [_0]) } - public var SocksProxySetup_Username: String { return self._s[1459]! } - public var Bot_Start: String { return self._s[1460]! } + public var SocksProxySetup_Username: String { return self._s[1454]! } + public var Bot_Start: String { return self._s[1455]! } public func Channel_AdminLog_EmptyFilterQueryText(_ _0: String) -> (String, [(Int, NSRange)]) { - return formatWithArgumentRanges(self._s[1461]!, self._r[1461]!, [_0]) + return formatWithArgumentRanges(self._s[1456]!, self._r[1456]!, [_0]) } public func Channel_AdminLog_MessagePinned(_ _0: String) -> (String, [(Int, NSRange)]) { - return formatWithArgumentRanges(self._s[1462]!, self._r[1462]!, [_0]) + return formatWithArgumentRanges(self._s[1457]!, self._r[1457]!, [_0]) } public func PINNED_GEOLIVE(_ _1: String) -> (String, [(Int, NSRange)]) { - return formatWithArgumentRanges(self._s[1464]!, self._r[1464]!, [_1]) + return formatWithArgumentRanges(self._s[1459]!, self._r[1459]!, [_1]) } - public var Conversation_DiscardVoiceMessageTitle: String { return self._s[1465]! } + public var Conversation_DiscardVoiceMessageTitle: String { return self._s[1460]! } public func PrivacySettings_LastSeenContactsMinus(_ _0: String) -> (String, [(Int, NSRange)]) { - return formatWithArgumentRanges(self._s[1466]!, self._r[1466]!, [_0]) + return formatWithArgumentRanges(self._s[1461]!, self._r[1461]!, [_0]) } - public var Passport_Email_EnterOtherEmail: String { return self._s[1467]! } - public var Login_InfoAvatarPhoto: String { return self._s[1468]! } - public var Privacy_PaymentsClear_ShippingInfo: String { return self._s[1469]! } - public var Tour_Title4: String { return self._s[1470]! } - public var Passport_Identity_Translation: String { return self._s[1471]! } - public var Login_TermsOfServiceLabel: String { return self._s[1473]! } - public var Passport_Language_it: String { return self._s[1474]! } - public var KeyCommand_JumpToNextUnreadChat: String { return self._s[1475]! } - public var Passport_Identity_SelfieHelp: String { return self._s[1476]! } - public var Conversation_ClearAll: String { return self._s[1478]! } + public var Passport_Email_EnterOtherEmail: String { return self._s[1462]! } + public var Login_InfoAvatarPhoto: String { return self._s[1463]! } + public var Privacy_PaymentsClear_ShippingInfo: String { return self._s[1464]! } + public var Tour_Title4: String { return self._s[1465]! } + public var Passport_Identity_Translation: String { return self._s[1466]! } + public var Login_TermsOfServiceLabel: String { return self._s[1468]! } + public var Passport_Language_it: String { return self._s[1469]! } + public var KeyCommand_JumpToNextUnreadChat: String { return self._s[1470]! } + public var Passport_Identity_SelfieHelp: String { return self._s[1471]! } + public var Conversation_ClearAll: String { return self._s[1473]! } public func MESSAGE_PHOTOS(_ _1: String, _ _2: String) -> (String, [(Int, NSRange)]) { - return formatWithArgumentRanges(self._s[1480]!, self._r[1480]!, [_1, _2]) + return formatWithArgumentRanges(self._s[1475]!, self._r[1475]!, [_1, _2]) } - public var TwoStepAuth_FloodError: String { return self._s[1481]! } - public var Paint_Delete: String { return self._s[1482]! } + public var TwoStepAuth_FloodError: String { return self._s[1476]! } + public var Paint_Delete: String { return self._s[1477]! } public func Passport_AcceptHelp(_ _1: String, _ _2: String) -> (String, [(Int, NSRange)]) { - return formatWithArgumentRanges(self._s[1483]!, self._r[1483]!, [_1, _2]) + return formatWithArgumentRanges(self._s[1478]!, self._r[1478]!, [_1, _2]) } - public var Message_PinnedAudioMessage: String { return self._s[1484]! } + public var Message_PinnedAudioMessage: String { return self._s[1479]! } public func Watch_Time_ShortTodayAt(_ _0: String) -> (String, [(Int, NSRange)]) { - return formatWithArgumentRanges(self._s[1485]!, self._r[1485]!, [_0]) + return formatWithArgumentRanges(self._s[1480]!, self._r[1480]!, [_0]) } - public var Notification_Mute1hMin: String { return self._s[1486]! } - public var Notifications_GroupNotificationsSound: String { return self._s[1487]! } - public var SocksProxySetup_ShareProxyList: String { return self._s[1488]! } - public var Conversation_MessageEditedLabel: String { return self._s[1489]! } - public var Notification_Exceptions_AlwaysOff: String { return self._s[1490]! } + public var Notification_Mute1hMin: String { return self._s[1481]! } + public var Notifications_GroupNotificationsSound: String { return self._s[1482]! } + public var SocksProxySetup_ShareProxyList: String { return self._s[1483]! } + public var Conversation_MessageEditedLabel: String { return self._s[1484]! } + public var Notification_Exceptions_AlwaysOff: String { return self._s[1485]! } public func Channel_AdminLog_MessageAdmin(_ _0: String, _ _1: String, _ _2: String) -> (String, [(Int, NSRange)]) { - return formatWithArgumentRanges(self._s[1491]!, self._r[1491]!, [_0, _1, _2]) + return formatWithArgumentRanges(self._s[1486]!, self._r[1486]!, [_0, _1, _2]) } - public var NetworkUsageSettings_ResetStats: String { return self._s[1492]! } - public var AccessDenied_LocationTracking: String { return self._s[1493]! } - public var Month_GenOctober: String { return self._s[1494]! } - public var GroupInfo_InviteLink_RevokeAlert_Revoke: String { return self._s[1495]! } - public var EnterPasscode_EnterPasscode: String { return self._s[1496]! } - public var MediaPicker_TimerTooltip: String { return self._s[1498]! } - public var SharedMedia_TitleAll: String { return self._s[1499]! } - public var Conversation_RestrictedMedia: String { return self._s[1501]! } - public var AccessDenied_PhotosRestricted: String { return self._s[1502]! } - public var ChangePhoneNumberCode_Called: String { return self._s[1504]! } + public var NetworkUsageSettings_ResetStats: String { return self._s[1487]! } + public var AccessDenied_LocationTracking: String { return self._s[1488]! } + public var Month_GenOctober: String { return self._s[1489]! } + public var GroupInfo_InviteLink_RevokeAlert_Revoke: String { return self._s[1490]! } + public var EnterPasscode_EnterPasscode: String { return self._s[1491]! } + public var MediaPicker_TimerTooltip: String { return self._s[1493]! } + public var SharedMedia_TitleAll: String { return self._s[1494]! } + public var Conversation_RestrictedMedia: String { return self._s[1496]! } + public var AccessDenied_PhotosRestricted: String { return self._s[1497]! } + public var ChangePhoneNumberCode_Called: String { return self._s[1499]! } public func Notification_PinnedDocumentMessage(_ _0: String) -> (String, [(Int, NSRange)]) { - return formatWithArgumentRanges(self._s[1505]!, self._r[1505]!, [_0]) + return formatWithArgumentRanges(self._s[1500]!, self._r[1500]!, [_0]) } - public var Conversation_SavedMessages: String { return self._s[1508]! } - public var Your_cards_expiration_month_is_invalid: String { return self._s[1510]! } - public var FastTwoStepSetup_PasswordPlaceholder: String { return self._s[1511]! } + public var Conversation_SavedMessages: String { return self._s[1503]! } + public var Your_cards_expiration_month_is_invalid: String { return self._s[1505]! } + public var FastTwoStepSetup_PasswordPlaceholder: String { return self._s[1506]! } public func Target_ShareGameConfirmationGroup(_ _0: String) -> (String, [(Int, NSRange)]) { - return formatWithArgumentRanges(self._s[1513]!, self._r[1513]!, [_0]) + return formatWithArgumentRanges(self._s[1508]!, self._r[1508]!, [_0]) } - public var ReportPeer_AlertSuccess: String { return self._s[1514]! } + public var ReportPeer_AlertSuccess: String { return self._s[1509]! } public func InstantPage_RelatedArticleAuthorAndDateTitle(_ _1: String, _ _2: String) -> (String, [(Int, NSRange)]) { - return formatWithArgumentRanges(self._s[1515]!, self._r[1515]!, [_1, _2]) + return formatWithArgumentRanges(self._s[1510]!, self._r[1510]!, [_1, _2]) } - public var PhotoEditor_CropAspectRatioOriginal: String { return self._s[1516]! } - public var Checkout_PasswordEntry_Title: String { return self._s[1517]! } - public var PhotoEditor_FadeTool: String { return self._s[1518]! } - public var Privacy_ContactsReset: String { return self._s[1519]! } + public var PhotoEditor_CropAspectRatioOriginal: String { return self._s[1511]! } + public var Checkout_PasswordEntry_Title: String { return self._s[1512]! } + public var PhotoEditor_FadeTool: String { return self._s[1513]! } + public var Privacy_ContactsReset: String { return self._s[1514]! } public func Channel_AdminLog_MessageRestrictedUntil(_ _0: String) -> (String, [(Int, NSRange)]) { - return formatWithArgumentRanges(self._s[1521]!, self._r[1521]!, [_0]) + return formatWithArgumentRanges(self._s[1516]!, self._r[1516]!, [_0]) } - public var Message_PinnedVideoMessage: String { return self._s[1522]! } - public var ShareMenu_SelectChats: String { return self._s[1524]! } - public var MusicPlayer_VoiceNote: String { return self._s[1525]! } - public var Conversation_RestrictedText: String { return self._s[1526]! } - public var TwoStepAuth_DisableSuccess: String { return self._s[1527]! } - public var Cache_Videos: String { return self._s[1528]! } - public var FeatureDisabled_Oops: String { return self._s[1530]! } - public var Passport_Address_PostcodePlaceholder: String { return self._s[1531]! } + public var Message_PinnedVideoMessage: String { return self._s[1517]! } + public var Permissions_CellularDataText_v0: String { return self._s[1518]! } + public var ShareMenu_SelectChats: String { return self._s[1520]! } + public var MusicPlayer_VoiceNote: String { return self._s[1521]! } + public var Conversation_RestrictedText: String { return self._s[1522]! } + public var TwoStepAuth_DisableSuccess: String { return self._s[1523]! } + public var Cache_Videos: String { return self._s[1524]! } + public var FeatureDisabled_Oops: String { return self._s[1526]! } + public var Passport_Address_PostcodePlaceholder: String { return self._s[1527]! } public func CHAT_MESSAGE_VIDEO(_ _1: String, _ _2: String) -> (String, [(Int, NSRange)]) { - return formatWithArgumentRanges(self._s[1532]!, self._r[1532]!, [_1, _2]) + return formatWithArgumentRanges(self._s[1528]!, self._r[1528]!, [_1, _2]) } - public var Stickers_GroupStickersHelp: String { return self._s[1533]! } - public var Message_VideoExpired: String { return self._s[1535]! } - public var Notifications_Badge: String { return self._s[1536]! } - public var GroupInfo_GroupHistoryVisible: String { return self._s[1537]! } - public var Username_InvalidTooShort: String { return self._s[1538]! } - public var EnterPasscode_EnterNewPasscodeChange: String { return self._s[1539]! } + public var Stickers_GroupStickersHelp: String { return self._s[1529]! } + public var Message_VideoExpired: String { return self._s[1531]! } + public var Notifications_Badge: String { return self._s[1532]! } + public var GroupInfo_GroupHistoryVisible: String { return self._s[1533]! } + public var Username_InvalidTooShort: String { return self._s[1534]! } + public var EnterPasscode_EnterNewPasscodeChange: String { return self._s[1535]! } public func Notification_MessageLifetimeRemoved(_ _1: String) -> (String, [(Int, NSRange)]) { - return formatWithArgumentRanges(self._s[1540]!, self._r[1540]!, [_1]) + return formatWithArgumentRanges(self._s[1536]!, self._r[1536]!, [_1]) } - public var SharedMedia_CategoryDocs: String { return self._s[1543]! } + public var Permissions_SiriAllowInSettings_v0: String { return self._s[1537]! } + public var SharedMedia_CategoryDocs: String { return self._s[1540]! } public func Notification_MessageLifetimeChangedOutgoing(_ _1: String) -> (String, [(Int, NSRange)]) { - return formatWithArgumentRanges(self._s[1545]!, self._r[1545]!, [_1]) + return formatWithArgumentRanges(self._s[1542]!, self._r[1542]!, [_1]) } - public var CheckoutInfo_ErrorShippingNotAvailable: String { return self._s[1546]! } + public var CheckoutInfo_ErrorShippingNotAvailable: String { return self._s[1543]! } public func Time_MonthOfYear_m12(_ _0: String) -> (String, [(Int, NSRange)]) { - return formatWithArgumentRanges(self._s[1547]!, self._r[1547]!, [_0]) + return formatWithArgumentRanges(self._s[1544]!, self._r[1544]!, [_0]) } - public var ChatSettings_PrivateChats: String { return self._s[1548]! } - public var Channel_UpdatePhotoItem: String { return self._s[1549]! } - public var GroupInfo_LeftStatus: String { return self._s[1550]! } - public var Watch_MessageView_Forward: String { return self._s[1552]! } - public var ReportPeer_ReasonChildAbuse: String { return self._s[1553]! } - public var Cache_ClearEmpty: String { return self._s[1555]! } - public var Localization_LanguageName: String { return self._s[1556]! } - public var WebSearch_GIFs: String { return self._s[1557]! } - public var Notifications_DisplayNamesOnLockScreenInfoWithLink: String { return self._s[1558]! } - public var Username_InvalidStartsWithNumber: String { return self._s[1559]! } - public var Common_Back: String { return self._s[1560]! } - public var Passport_Identity_DateOfBirthPlaceholder: String { return self._s[1561]! } + public var ChatSettings_PrivateChats: String { return self._s[1545]! } + public var Channel_UpdatePhotoItem: String { return self._s[1546]! } + public var GroupInfo_LeftStatus: String { return self._s[1547]! } + public var Watch_MessageView_Forward: String { return self._s[1549]! } + public var ReportPeer_ReasonChildAbuse: String { return self._s[1550]! } + public var Cache_ClearEmpty: String { return self._s[1552]! } + public var Localization_LanguageName: String { return self._s[1553]! } + public var WebSearch_GIFs: String { return self._s[1554]! } + public var Notifications_DisplayNamesOnLockScreenInfoWithLink: String { return self._s[1555]! } + public var Username_InvalidStartsWithNumber: String { return self._s[1556]! } + public var Common_Back: String { return self._s[1557]! } + public var Passport_Identity_DateOfBirthPlaceholder: String { return self._s[1558]! } public func CHANNEL_MESSAGE_AUDIO(_ _1: String) -> (String, [(Int, NSRange)]) { - return formatWithArgumentRanges(self._s[1562]!, self._r[1562]!, [_1]) + return formatWithArgumentRanges(self._s[1559]!, self._r[1559]!, [_1]) } public func CHANNEL_MESSAGE_ROUND(_ _1: String) -> (String, [(Int, NSRange)]) { - return formatWithArgumentRanges(self._s[1563]!, self._r[1563]!, [_1]) + return formatWithArgumentRanges(self._s[1560]!, self._r[1560]!, [_1]) } - public var Passport_Email_Help: String { return self._s[1564]! } - public var Watch_Conversation_Reply: String { return self._s[1565]! } - public var Conversation_EditingMessageMediaChange: String { return self._s[1567]! } - public var Passport_Identity_IssueDatePlaceholder: String { return self._s[1568]! } - public var Channel_BanUser_Unban: String { return self._s[1570]! } - public var Channel_EditAdmin_PermissionPostMessages: String { return self._s[1571]! } - public var Group_Username_CreatePublicLinkHelp: String { return self._s[1572]! } - public var TwoStepAuth_ConfirmEmailCodePlaceholder: String { return self._s[1573]! } - public var Passport_Identity_Name: String { return self._s[1575]! } - public var Conversation_BlockUser: String { return self._s[1576]! } - public var Month_GenJanuary: String { return self._s[1577]! } - public var ChatSettings_TextSize: String { return self._s[1578]! } - public var Notification_PassportValuePhone: String { return self._s[1579]! } - public var Passport_Language_ne: String { return self._s[1580]! } - public var Notification_CallBack: String { return self._s[1581]! } - public var TwoStepAuth_EmailHelp: String { return self._s[1582]! } + public var Passport_Email_Help: String { return self._s[1561]! } + public var Watch_Conversation_Reply: String { return self._s[1562]! } + public var Conversation_EditingMessageMediaChange: String { return self._s[1564]! } + public var Passport_Identity_IssueDatePlaceholder: String { return self._s[1565]! } + public var Channel_BanUser_Unban: String { return self._s[1567]! } + public var Channel_EditAdmin_PermissionPostMessages: String { return self._s[1568]! } + public var Group_Username_CreatePublicLinkHelp: String { return self._s[1569]! } + public var TwoStepAuth_ConfirmEmailCodePlaceholder: String { return self._s[1570]! } + public var Passport_Identity_Name: String { return self._s[1572]! } + public var Conversation_BlockUser: String { return self._s[1573]! } + public var Month_GenJanuary: String { return self._s[1574]! } + public var ChatSettings_TextSize: String { return self._s[1575]! } + public var Notification_PassportValuePhone: String { return self._s[1576]! } + public var Passport_Language_ne: String { return self._s[1577]! } + public var Notification_CallBack: String { return self._s[1578]! } + public var TwoStepAuth_EmailHelp: String { return self._s[1579]! } public func Time_YesterdayAt(_ _0: String) -> (String, [(Int, NSRange)]) { - return formatWithArgumentRanges(self._s[1583]!, self._r[1583]!, [_0]) + return formatWithArgumentRanges(self._s[1580]!, self._r[1580]!, [_0]) } - public var Channel_Info_Management: String { return self._s[1584]! } - public var Passport_FieldIdentityUploadHelp: String { return self._s[1585]! } - public var Stickers_FrequentlyUsed: String { return self._s[1586]! } - public var Channel_BanUser_PermissionSendMessages: String { return self._s[1587]! } - public var Passport_Address_OneOfTypeUtilityBill: String { return self._s[1589]! } - public var Passport_Address_EditResidentialAddress: String { return self._s[1590]! } - public var PrivacyPolicy_DeclineTitle: String { return self._s[1591]! } + public var Channel_Info_Management: String { return self._s[1581]! } + public var Passport_FieldIdentityUploadHelp: String { return self._s[1582]! } + public var Stickers_FrequentlyUsed: String { return self._s[1583]! } + public var Channel_BanUser_PermissionSendMessages: String { return self._s[1584]! } + public var Passport_Address_OneOfTypeUtilityBill: String { return self._s[1586]! } + public var Passport_Address_EditResidentialAddress: String { return self._s[1587]! } + public var PrivacyPolicy_DeclineTitle: String { return self._s[1588]! } public func Checkout_SavePasswordTimeoutAndTouchId(_ _0: String) -> (String, [(Int, NSRange)]) { + return formatWithArgumentRanges(self._s[1589]!, self._r[1589]!, [_0]) + } + public var PhotoEditor_QualityMedium: String { return self._s[1590]! } + public var InfoPlist_NSMicrophoneUsageDescription: String { return self._s[1591]! } + public func Conversation_RestrictedInlineTimed(_ _0: String) -> (String, [(Int, NSRange)]) { return formatWithArgumentRanges(self._s[1592]!, self._r[1592]!, [_0]) } - public var PhotoEditor_QualityMedium: String { return self._s[1593]! } - public var InfoPlist_NSMicrophoneUsageDescription: String { return self._s[1594]! } - public func Conversation_RestrictedInlineTimed(_ _0: String) -> (String, [(Int, NSRange)]) { - return formatWithArgumentRanges(self._s[1595]!, self._r[1595]!, [_0]) - } - public var Conversation_StatusKickedFromChannel: String { return self._s[1596]! } - public var CheckoutInfo_ReceiverInfoName: String { return self._s[1597]! } - public var Group_ErrorSendRestrictedStickers: String { return self._s[1598]! } - public var Conversation_LinkDialogOpen: String { return self._s[1600]! } - public var Settings_Username: String { return self._s[1601]! } - public var Wallpaper_Wallpaper: String { return self._s[1603]! } + public var Conversation_StatusKickedFromChannel: String { return self._s[1593]! } + public var CheckoutInfo_ReceiverInfoName: String { return self._s[1594]! } + public var Group_ErrorSendRestrictedStickers: String { return self._s[1595]! } + public var Conversation_LinkDialogOpen: String { return self._s[1597]! } + public var Settings_Username: String { return self._s[1598]! } + public var Wallpaper_Wallpaper: String { return self._s[1600]! } public func PINNED_GIF(_ _1: String) -> (String, [(Int, NSRange)]) { - return formatWithArgumentRanges(self._s[1605]!, self._r[1605]!, [_1]) + return formatWithArgumentRanges(self._s[1602]!, self._r[1602]!, [_1]) } - public var SocksProxySetup_UseProxy: String { return self._s[1606]! } - public var UserInfo_ShareMyContactInfo: String { return self._s[1607]! } - public var MessageTimer_Forever: String { return self._s[1608]! } - public var Privacy_Calls_WhoCanCallMe: String { return self._s[1609]! } - public var PhotoEditor_DiscardChanges: String { return self._s[1610]! } - public var AuthSessions_TerminateOtherSessionsHelp: String { return self._s[1611]! } - public var Passport_Language_da: String { return self._s[1612]! } - public var SocksProxySetup_PortPlaceholder: String { return self._s[1613]! } - public var Passport_Address_EditPassportRegistration: String { return self._s[1615]! } + public var SocksProxySetup_UseProxy: String { return self._s[1603]! } + public var UserInfo_ShareMyContactInfo: String { return self._s[1604]! } + public var MessageTimer_Forever: String { return self._s[1605]! } + public var Privacy_Calls_WhoCanCallMe: String { return self._s[1606]! } + public var PhotoEditor_DiscardChanges: String { return self._s[1607]! } + public var AuthSessions_TerminateOtherSessionsHelp: String { return self._s[1608]! } + public var Passport_Language_da: String { return self._s[1609]! } + public var SocksProxySetup_PortPlaceholder: String { return self._s[1610]! } + public func SecretGIF_NotViewedYet(_ _0: String) -> (String, [(Int, NSRange)]) { + return formatWithArgumentRanges(self._s[1611]!, self._r[1611]!, [_0]) + } + public var Passport_Address_EditPassportRegistration: String { return self._s[1612]! } public func Channel_AdminLog_MessageChangedGroupAbout(_ _0: String) -> (String, [(Int, NSRange)]) { - return formatWithArgumentRanges(self._s[1616]!, self._r[1616]!, [_0]) + return formatWithArgumentRanges(self._s[1614]!, self._r[1614]!, [_0]) } - public var Passport_Identity_ResidenceCountryPlaceholder: String { return self._s[1618]! } - public var Conversation_SearchByName_Prefix: String { return self._s[1619]! } + public var Passport_Identity_ResidenceCountryPlaceholder: String { return self._s[1616]! } + public var Conversation_SearchByName_Prefix: String { return self._s[1617]! } public func PINNED_AUDIO(_ _1: String) -> (String, [(Int, NSRange)]) { - return formatWithArgumentRanges(self._s[1620]!, self._r[1620]!, [_1]) + return formatWithArgumentRanges(self._s[1618]!, self._r[1618]!, [_1]) } - public var Conversation_EmptyGifPanelPlaceholder: String { return self._s[1621]! } - public var Cache_ByPeerHeader: String { return self._s[1622]! } + public var Conversation_EmptyGifPanelPlaceholder: String { return self._s[1619]! } + public var Cache_ByPeerHeader: String { return self._s[1620]! } public func Conversation_EncryptedPlaceholderTitleIncoming(_ _0: String) -> (String, [(Int, NSRange)]) { - return formatWithArgumentRanges(self._s[1623]!, self._r[1623]!, [_0]) + return formatWithArgumentRanges(self._s[1621]!, self._r[1621]!, [_0]) } - public var ChatSettings_AutoDownloadDocuments: String { return self._s[1624]! } - public var Notification_PinnedMessage: String { return self._s[1627]! } - public var Call_EncryptionKey_Title: String { return self._s[1630]! } - public var Watch_UserInfo_Service: String { return self._s[1631]! } - public var Conversation_Unpin: String { return self._s[1634]! } - public var CancelResetAccount_Title: String { return self._s[1635]! } - public var Map_LiveLocationFor15Minutes: String { return self._s[1636]! } + public var ChatSettings_AutoDownloadDocuments: String { return self._s[1622]! } + public var Notification_PinnedMessage: String { return self._s[1625]! } + public var Call_EncryptionKey_Title: String { return self._s[1628]! } + public var Watch_UserInfo_Service: String { return self._s[1629]! } + public var Conversation_Unpin: String { return self._s[1632]! } + public var CancelResetAccount_Title: String { return self._s[1633]! } + public var Map_LiveLocationFor15Minutes: String { return self._s[1634]! } public func Time_PreciseDate_m8(_ _1: String, _ _2: String, _ _3: String) -> (String, [(Int, NSRange)]) { - return formatWithArgumentRanges(self._s[1638]!, self._r[1638]!, [_1, _2, _3]) + return formatWithArgumentRanges(self._s[1636]!, self._r[1636]!, [_1, _2, _3]) } - public var Group_Members_AddMemberBotErrorNotAllowed: String { return self._s[1639]! } - public var CallSettings_Title: String { return self._s[1640]! } - public var PasscodeSettings_EncryptDataHelp: String { return self._s[1642]! } - public var AutoDownloadSettings_Contacts: String { return self._s[1643]! } - public var Passport_Identity_DocumentDetails: String { return self._s[1644]! } - public var LoginPassword_PasswordHelp: String { return self._s[1645]! } - public var PrivacyLastSeenSettings_CustomShareSettings_Delete: String { return self._s[1646]! } - public var Checkout_TotalPaidAmount: String { return self._s[1647]! } + public var Group_Members_AddMemberBotErrorNotAllowed: String { return self._s[1637]! } + public var CallSettings_Title: String { return self._s[1638]! } + public var PasscodeSettings_EncryptDataHelp: String { return self._s[1640]! } + public var AutoDownloadSettings_Contacts: String { return self._s[1641]! } + public var Passport_Identity_DocumentDetails: String { return self._s[1642]! } + public var LoginPassword_PasswordHelp: String { return self._s[1643]! } + public var PrivacyLastSeenSettings_CustomShareSettings_Delete: String { return self._s[1644]! } + public var Checkout_TotalPaidAmount: String { return self._s[1645]! } public func FileSize_KB(_ _0: String) -> (String, [(Int, NSRange)]) { - return formatWithArgumentRanges(self._s[1648]!, self._r[1648]!, [_0]) + return formatWithArgumentRanges(self._s[1646]!, self._r[1646]!, [_0]) } - public var PasscodeSettings_ChangePasscode: String { return self._s[1649]! } - public var Conversation_SecretLinkPreviewAlert: String { return self._s[1651]! } - public var Privacy_SecretChatsLinkPreviews: String { return self._s[1652]! } - public var Contacts_InviteFriends: String { return self._s[1654]! } - public var Map_ChooseLocationTitle: String { return self._s[1655]! } - public var Calls_RatingFeedback: String { return self._s[1657]! } - public var GroupInfo_BroadcastListNamePlaceholder: String { return self._s[1658]! } - public var NotificationsSound_Pulse: String { return self._s[1659]! } - public var Watch_LastSeen_Lately: String { return self._s[1660]! } - public var Widget_NoUsers: String { return self._s[1663]! } - public var NotificationsSound_Circles: String { return self._s[1665]! } - public var PrivacyLastSeenSettings_AlwaysShareWith_Title: String { return self._s[1667]! } + public var PasscodeSettings_ChangePasscode: String { return self._s[1647]! } + public var Conversation_SecretLinkPreviewAlert: String { return self._s[1649]! } + public var Privacy_SecretChatsLinkPreviews: String { return self._s[1650]! } + public var Contacts_InviteFriends: String { return self._s[1652]! } + public var Map_ChooseLocationTitle: String { return self._s[1653]! } + public var Calls_RatingFeedback: String { return self._s[1655]! } + public var GroupInfo_BroadcastListNamePlaceholder: String { return self._s[1656]! } + public var NotificationsSound_Pulse: String { return self._s[1657]! } + public var Watch_LastSeen_Lately: String { return self._s[1658]! } + public var Widget_NoUsers: String { return self._s[1661]! } + public var NotificationsSound_Circles: String { return self._s[1663]! } + public var PrivacyLastSeenSettings_AlwaysShareWith_Title: String { return self._s[1665]! } public func CHANNEL_MESSAGE_GEOLIVE(_ _1: String) -> (String, [(Int, NSRange)]) { - return formatWithArgumentRanges(self._s[1668]!, self._r[1668]!, [_1]) + return formatWithArgumentRanges(self._s[1666]!, self._r[1666]!, [_1]) } - public var TwoStepAuth_RecoveryCodeExpired: String { return self._s[1669]! } + public var TwoStepAuth_RecoveryCodeExpired: String { return self._s[1667]! } public func CHAT_MESSAGE_GIF(_ _1: String, _ _2: String) -> (String, [(Int, NSRange)]) { - return formatWithArgumentRanges(self._s[1670]!, self._r[1670]!, [_1, _2]) + return formatWithArgumentRanges(self._s[1668]!, self._r[1668]!, [_1, _2]) } - public var Passport_Identity_CountryPlaceholder: String { return self._s[1672]! } - public var Conversation_FileDropbox: String { return self._s[1674]! } - public var Notifications_ExceptionsUnmuted: String { return self._s[1675]! } - public var Tour_Text3: String { return self._s[1677]! } - public var Login_ResetAccountProtected_Title: String { return self._s[1679]! } - public var ChatAdmins_AllMembersAreAdminsOnHelp: String { return self._s[1680]! } + public var Passport_Identity_CountryPlaceholder: String { return self._s[1670]! } + public var Conversation_FileDropbox: String { return self._s[1672]! } + public var Notifications_ExceptionsUnmuted: String { return self._s[1673]! } + public var Tour_Text3: String { return self._s[1675]! } + public var Login_ResetAccountProtected_Title: String { return self._s[1677]! } + public var ChatAdmins_AllMembersAreAdminsOnHelp: String { return self._s[1678]! } public func Conversation_LiveLocationYouAnd(_ _0: String) -> (String, [(Int, NSRange)]) { - return formatWithArgumentRanges(self._s[1682]!, self._r[1682]!, [_0]) + return formatWithArgumentRanges(self._s[1680]!, self._r[1680]!, [_0]) } - public var GroupInfo_AddParticipantTitle: String { return self._s[1683]! } - public var Checkout_ShippingOption_Title: String { return self._s[1684]! } - public var ChatSettings_AutoDownloadTitle: String { return self._s[1685]! } + public var GroupInfo_AddParticipantTitle: String { return self._s[1681]! } + public var Checkout_ShippingOption_Title: String { return self._s[1682]! } + public var ChatSettings_AutoDownloadTitle: String { return self._s[1683]! } public func DialogList_SingleTypingSuffix(_ _0: String) -> (String, [(Int, NSRange)]) { - return formatWithArgumentRanges(self._s[1686]!, self._r[1686]!, [_0]) + return formatWithArgumentRanges(self._s[1684]!, self._r[1684]!, [_0]) } public func CHAT_MESSAGE_ROUND(_ _1: String, _ _2: String) -> (String, [(Int, NSRange)]) { - return formatWithArgumentRanges(self._s[1687]!, self._r[1687]!, [_1, _2]) + return formatWithArgumentRanges(self._s[1685]!, self._r[1685]!, [_1, _2]) } - public var PrivacyLastSeenSettings_NeverShareWith_Placeholder: String { return self._s[1688]! } - public var Appearance_PreviewIncomingText: String { return self._s[1690]! } - public var ChannelInfo_ConfirmLeave: String { return self._s[1691]! } - public var MediaPicker_MomentsDateRangeSameMonthYearFormat: String { return self._s[1692]! } - public var Passport_Identity_DocumentNumberPlaceholder: String { return self._s[1693]! } - public var Channel_AdminLogFilter_EventsNewMembers: String { return self._s[1694]! } - public var PasscodeSettings_AutoLock_IfAwayFor_5minutes: String { return self._s[1695]! } - public var GroupInfo_SetGroupPhotoStop: String { return self._s[1696]! } - public var Notification_SecretChatScreenshot: String { return self._s[1697]! } - public var Passport_Address_City: String { return self._s[1699]! } - public var InfoPlist_NSPhotoLibraryAddUsageDescription: String { return self._s[1700]! } - public var SocksProxySetup_SecretPlaceholder: String { return self._s[1701]! } - public var AccessDenied_LocationDisabled: String { return self._s[1702]! } - public var SocksProxySetup_HostnamePlaceholder: String { return self._s[1704]! } - public var GroupInfo_Sound: String { return self._s[1705]! } - public var Stickers_RemoveFromFavorites: String { return self._s[1706]! } - public var Contacts_Title: String { return self._s[1707]! } - public var Passport_Language_fr: String { return self._s[1708]! } + public var PrivacyLastSeenSettings_NeverShareWith_Placeholder: String { return self._s[1686]! } + public var Appearance_PreviewIncomingText: String { return self._s[1688]! } + public var ChannelInfo_ConfirmLeave: String { return self._s[1689]! } + public var MediaPicker_MomentsDateRangeSameMonthYearFormat: String { return self._s[1690]! } + public var Passport_Identity_DocumentNumberPlaceholder: String { return self._s[1691]! } + public var Channel_AdminLogFilter_EventsNewMembers: String { return self._s[1692]! } + public var PasscodeSettings_AutoLock_IfAwayFor_5minutes: String { return self._s[1693]! } + public var GroupInfo_SetGroupPhotoStop: String { return self._s[1694]! } + public var Notification_SecretChatScreenshot: String { return self._s[1695]! } + public var Passport_Address_City: String { return self._s[1697]! } + public var InfoPlist_NSPhotoLibraryAddUsageDescription: String { return self._s[1698]! } + public var SocksProxySetup_SecretPlaceholder: String { return self._s[1699]! } + public var AccessDenied_LocationDisabled: String { return self._s[1700]! } + public var SocksProxySetup_HostnamePlaceholder: String { return self._s[1702]! } + public var GroupInfo_Sound: String { return self._s[1703]! } + public var Stickers_RemoveFromFavorites: String { return self._s[1704]! } + public var Contacts_Title: String { return self._s[1705]! } + public var Passport_Language_fr: String { return self._s[1706]! } public func CHAT_TITLE_EDITED(_ _1: String, _ _2: String) -> (String, [(Int, NSRange)]) { - return formatWithArgumentRanges(self._s[1709]!, self._r[1709]!, [_1, _2]) + return formatWithArgumentRanges(self._s[1707]!, self._r[1707]!, [_1, _2]) } - public var Notifications_ResetAllNotifications: String { return self._s[1710]! } - public var PrivacySettings_SecurityTitle: String { return self._s[1713]! } - public var Checkout_NewCard_Title: String { return self._s[1714]! } - public var Login_HaveNotReceivedCodeInternal: String { return self._s[1715]! } - public var Conversation_ForwardChats: String { return self._s[1716]! } - public var Settings_FAQ: String { return self._s[1719]! } - public var AutoDownloadSettings_DocumentsTitle: String { return self._s[1720]! } - public var Conversation_ContextMenuForward: String { return self._s[1721]! } - public var PrivacyPolicy_Title: String { return self._s[1726]! } - public var Notifications_TextTone: String { return self._s[1727]! } - public var Profile_CreateNewContact: String { return self._s[1728]! } - public var AutoNightTheme_AutomaticSection: String { return self._s[1730]! } - public var Channel_Username_InvalidCharacters: String { return self._s[1732]! } + public var Notifications_ResetAllNotifications: String { return self._s[1708]! } + public var PrivacySettings_SecurityTitle: String { return self._s[1711]! } + public var Checkout_NewCard_Title: String { return self._s[1712]! } + public var Login_HaveNotReceivedCodeInternal: String { return self._s[1713]! } + public var Conversation_ForwardChats: String { return self._s[1714]! } + public var Settings_FAQ: String { return self._s[1717]! } + public var AutoDownloadSettings_DocumentsTitle: String { return self._s[1718]! } + public var Conversation_ContextMenuForward: String { return self._s[1719]! } + public var PrivacyPolicy_Title: String { return self._s[1724]! } + public var Notifications_TextTone: String { return self._s[1725]! } + public var Profile_CreateNewContact: String { return self._s[1726]! } + public var AutoNightTheme_AutomaticSection: String { return self._s[1728]! } + public var Channel_Username_InvalidCharacters: String { return self._s[1730]! } public func Channel_AdminLog_MessageChangedChannelUsername(_ _0: String) -> (String, [(Int, NSRange)]) { - return formatWithArgumentRanges(self._s[1733]!, self._r[1733]!, [_0]) + return formatWithArgumentRanges(self._s[1731]!, self._r[1731]!, [_0]) } - public var Channel_AdminLog_CanInviteUsers: String { return self._s[1734]! } - public var Conversation_MessageDeliveryFailed: String { return self._s[1735]! } - public var TextFormat_Italic: String { return self._s[1736]! } - public var Bot_Unblock: String { return self._s[1737]! } - public var Watch_ChatList_NoConversationsText: String { return self._s[1738]! } - public var Weekday_Wednesday: String { return self._s[1739]! } - public var Settings_About_Help: String { return self._s[1740]! } - public var SearchImages_Title: String { return self._s[1741]! } - public var Conversation_ClousStorageInfo_Description1: String { return self._s[1742]! } - public var ExplicitContent_AlertTitle: String { return self._s[1743]! } + public var Channel_AdminLog_CanInviteUsers: String { return self._s[1732]! } + public var Conversation_MessageDeliveryFailed: String { return self._s[1733]! } + public var TextFormat_Italic: String { return self._s[1734]! } + public var Bot_Unblock: String { return self._s[1735]! } + public var Watch_ChatList_NoConversationsText: String { return self._s[1736]! } + public var Weekday_Wednesday: String { return self._s[1737]! } + public var Settings_About_Help: String { return self._s[1738]! } + public var SearchImages_Title: String { return self._s[1739]! } + public var Conversation_ClousStorageInfo_Description1: String { return self._s[1740]! } + public var ExplicitContent_AlertTitle: String { return self._s[1741]! } public func Time_PreciseDate_m5(_ _1: String, _ _2: String, _ _3: String) -> (String, [(Int, NSRange)]) { - return formatWithArgumentRanges(self._s[1744]!, self._r[1744]!, [_1, _2, _3]) + return formatWithArgumentRanges(self._s[1742]!, self._r[1742]!, [_1, _2, _3]) } - public var Weekday_Thursday: String { return self._s[1745]! } - public var Channel_Members_AddMembersHelp: String { return self._s[1746]! } + public var Weekday_Thursday: String { return self._s[1743]! } + public var Channel_Members_AddMembersHelp: String { return self._s[1744]! } public func Checkout_SavePasswordTimeout(_ _0: String) -> (String, [(Int, NSRange)]) { - return formatWithArgumentRanges(self._s[1747]!, self._r[1747]!, [_0]) + return formatWithArgumentRanges(self._s[1745]!, self._r[1745]!, [_0]) } - public var Passport_RequestedInformation: String { return self._s[1748]! } - public var Login_PhoneAndCountryHelp: String { return self._s[1749]! } + public var Passport_RequestedInformation: String { return self._s[1746]! } + public var Login_PhoneAndCountryHelp: String { return self._s[1747]! } public func CHAT_MESSAGE_AUDIO(_ _1: String, _ _2: String) -> (String, [(Int, NSRange)]) { - return formatWithArgumentRanges(self._s[1750]!, self._r[1750]!, [_1, _2]) + return formatWithArgumentRanges(self._s[1748]!, self._r[1748]!, [_1, _2]) } - public var Conversation_EncryptionProcessing: String { return self._s[1751]! } - public var PhotoEditor_EnhanceTool: String { return self._s[1754]! } - public var Channel_Setup_Title: String { return self._s[1755]! } - public var Conversation_SearchPlaceholder: String { return self._s[1756]! } - public var AccessDenied_LocationAlwaysDenied: String { return self._s[1757]! } - public var Checkout_ErrorGeneric: String { return self._s[1758]! } - public var Passport_Language_hu: String { return self._s[1759]! } + public var Conversation_EncryptionProcessing: String { return self._s[1749]! } + public var PhotoEditor_EnhanceTool: String { return self._s[1752]! } + public var Channel_Setup_Title: String { return self._s[1753]! } + public var Conversation_SearchPlaceholder: String { return self._s[1754]! } + public var AccessDenied_LocationAlwaysDenied: String { return self._s[1755]! } + public var Checkout_ErrorGeneric: String { return self._s[1756]! } + public var Passport_Language_hu: String { return self._s[1757]! } public func Passport_Identity_UploadOneOfScan(_ _0: String) -> (String, [(Int, NSRange)]) { - return formatWithArgumentRanges(self._s[1761]!, self._r[1761]!, [_0]) + return formatWithArgumentRanges(self._s[1759]!, self._r[1759]!, [_0]) } - public var Conversation_CloudStorageInfo_Title: String { return self._s[1764]! } - public var PhotoEditor_CropAspectRatioSquare: String { return self._s[1765]! } + public var Conversation_CloudStorageInfo_Title: String { return self._s[1762]! } + public var PhotoEditor_CropAspectRatioSquare: String { return self._s[1763]! } public func Notification_Exceptions_MutedUntil(_ _0: String) -> (String, [(Int, NSRange)]) { - return formatWithArgumentRanges(self._s[1766]!, self._r[1766]!, [_0]) + return formatWithArgumentRanges(self._s[1764]!, self._r[1764]!, [_0]) } - public var Conversation_ClearPrivateHistory: String { return self._s[1767]! } - public var ContactInfo_PhoneLabelHome: String { return self._s[1768]! } - public var PrivacySettings_LastSeenContacts: String { return self._s[1769]! } + public var Conversation_ClearPrivateHistory: String { return self._s[1765]! } + public var ContactInfo_PhoneLabelHome: String { return self._s[1766]! } + public var PrivacySettings_LastSeenContacts: String { return self._s[1767]! } public func ChangePhone_ErrorOccupied(_ _0: String) -> (String, [(Int, NSRange)]) { - return formatWithArgumentRanges(self._s[1770]!, self._r[1770]!, [_0]) + return formatWithArgumentRanges(self._s[1768]!, self._r[1768]!, [_0]) } - public var Passport_Language_cs: String { return self._s[1771]! } - public var Message_PinnedAnimationMessage: String { return self._s[1772]! } - public var Passport_Identity_ReverseSideHelp: String { return self._s[1774]! } - public var Embed_PlayingInPIP: String { return self._s[1776]! } - public var AutoNightTheme_ScheduleSection: String { return self._s[1777]! } + public var Passport_Language_cs: String { return self._s[1769]! } + public var Message_PinnedAnimationMessage: String { return self._s[1770]! } + public var Passport_Identity_ReverseSideHelp: String { return self._s[1772]! } + public var Embed_PlayingInPIP: String { return self._s[1774]! } + public var AutoNightTheme_ScheduleSection: String { return self._s[1775]! } public func Call_EmojiDescription(_ _0: String) -> (String, [(Int, NSRange)]) { - return formatWithArgumentRanges(self._s[1778]!, self._r[1778]!, [_0]) + return formatWithArgumentRanges(self._s[1776]!, self._r[1776]!, [_0]) } - public var MediaPicker_LivePhotoDescription: String { return self._s[1779]! } + public var MediaPicker_LivePhotoDescription: String { return self._s[1777]! } public func Channel_AdminLog_MessageRestrictedName(_ _1: String) -> (String, [(Int, NSRange)]) { - return formatWithArgumentRanges(self._s[1780]!, self._r[1780]!, [_1]) + return formatWithArgumentRanges(self._s[1778]!, self._r[1778]!, [_1]) } - public var Notification_PaymentSent: String { return self._s[1781]! } - public var PhotoEditor_CurvesGreen: String { return self._s[1782]! } - public var SaveIncomingPhotosSettings_Title: String { return self._s[1783]! } + public var Notification_PaymentSent: String { return self._s[1779]! } + public var PhotoEditor_CurvesGreen: String { return self._s[1780]! } + public var SaveIncomingPhotosSettings_Title: String { return self._s[1781]! } public func ApplyLanguage_UnsufficientDataText(_ _1: String) -> (String, [(Int, NSRange)]) { - return formatWithArgumentRanges(self._s[1784]!, self._r[1784]!, [_1]) + return formatWithArgumentRanges(self._s[1782]!, self._r[1782]!, [_1]) } public func CHAT_MESSAGE_GEOLIVE(_ _1: String, _ _2: String) -> (String, [(Int, NSRange)]) { - return formatWithArgumentRanges(self._s[1785]!, self._r[1785]!, [_1, _2]) + return formatWithArgumentRanges(self._s[1783]!, self._r[1783]!, [_1, _2]) } - public var NetworkUsageSettings_CallDataSection: String { return self._s[1786]! } - public var PasscodeSettings_HelpTop: String { return self._s[1787]! } - public var Passport_Address_TypeRentalAgreement: String { return self._s[1788]! } - public var ReportPeer_ReasonOther_Placeholder: String { return self._s[1789]! } - public var CheckoutInfo_ErrorPhoneInvalid: String { return self._s[1790]! } - public var Call_Accept: String { return self._s[1792]! } - public var Month_GenMarch: String { return self._s[1793]! } - public var PhotoEditor_ShadowsTool: String { return self._s[1794]! } - public var LoginPassword_Title: String { return self._s[1795]! } - public var Watch_Conversation_GroupInfo: String { return self._s[1796]! } - public var CallSettings_Always: String { return self._s[1797]! } - public var TwoStepAuth_SetupHint: String { return self._s[1798]! } - public var ConversationProfile_UsersTooMuchError: String { return self._s[1799]! } - public var Login_PhoneTitle: String { return self._s[1800]! } - public var Passport_FieldPhoneHelp: String { return self._s[1801]! } - public var Weekday_ShortSunday: String { return self._s[1802]! } - public var Passport_InfoFAQ_URL: String { return self._s[1803]! } - public var ContactInfo_Job: String { return self._s[1805]! } - public var UserInfo_InviteBotToGroup: String { return self._s[1806]! } - public var TwoStepAuth_PasswordRemovePassportConfirmation: String { return self._s[1807]! } - public var Passport_DeletePersonalDetailsConfirmation: String { return self._s[1808]! } - public var Passport_Identity_AddInternalPassport: String { return self._s[1810]! } - public var MediaPicker_AddCaption: String { return self._s[1811]! } - public var CallSettings_TabIconDescription: String { return self._s[1812]! } - public var Privacy_GroupsAndChannels_AlwaysAllow: String { return self._s[1813]! } - public var Passport_Identity_TypePersonalDetails: String { return self._s[1814]! } - public var DialogList_SearchSectionRecent: String { return self._s[1815]! } - public var PrivacyPolicy_DeclineMessage: String { return self._s[1816]! } - public var LastSeen_WithinAWeek: String { return self._s[1818]! } - public var ChannelMembers_GroupAdminsTitle: String { return self._s[1819]! } - public var Conversation_CloudStorage_ChatStatus: String { return self._s[1821]! } - public var Passport_Address_TypeResidentialAddress: String { return self._s[1822]! } - public var Conversation_StatusLeftGroup: String { return self._s[1823]! } - public var SocksProxySetup_ProxyDetailsTitle: String { return self._s[1824]! } - public var PhotoEditor_BlurToolRadial: String { return self._s[1827]! } - public var Conversation_ContextMenuCopy: String { return self._s[1828]! } - public var AccessDenied_CallMicrophone: String { return self._s[1829]! } + public var NetworkUsageSettings_CallDataSection: String { return self._s[1784]! } + public var PasscodeSettings_HelpTop: String { return self._s[1785]! } + public var Passport_Address_TypeRentalAgreement: String { return self._s[1786]! } + public var ReportPeer_ReasonOther_Placeholder: String { return self._s[1787]! } + public var CheckoutInfo_ErrorPhoneInvalid: String { return self._s[1788]! } + public var Call_Accept: String { return self._s[1790]! } + public var Month_GenMarch: String { return self._s[1791]! } + public var PhotoEditor_ShadowsTool: String { return self._s[1792]! } + public var LoginPassword_Title: String { return self._s[1793]! } + public var Watch_Conversation_GroupInfo: String { return self._s[1794]! } + public var CallSettings_Always: String { return self._s[1795]! } + public var TwoStepAuth_SetupHint: String { return self._s[1796]! } + public var ConversationProfile_UsersTooMuchError: String { return self._s[1797]! } + public var Login_PhoneTitle: String { return self._s[1798]! } + public var Passport_FieldPhoneHelp: String { return self._s[1799]! } + public var Weekday_ShortSunday: String { return self._s[1800]! } + public var Passport_InfoFAQ_URL: String { return self._s[1801]! } + public var ContactInfo_Job: String { return self._s[1803]! } + public var UserInfo_InviteBotToGroup: String { return self._s[1804]! } + public var TwoStepAuth_PasswordRemovePassportConfirmation: String { return self._s[1805]! } + public var Passport_DeletePersonalDetailsConfirmation: String { return self._s[1806]! } + public var Passport_Identity_AddInternalPassport: String { return self._s[1808]! } + public var MediaPicker_AddCaption: String { return self._s[1809]! } + public var CallSettings_TabIconDescription: String { return self._s[1810]! } + public var Privacy_GroupsAndChannels_AlwaysAllow: String { return self._s[1811]! } + public var Passport_Identity_TypePersonalDetails: String { return self._s[1812]! } + public var DialogList_SearchSectionRecent: String { return self._s[1813]! } + public var PrivacyPolicy_DeclineMessage: String { return self._s[1814]! } + public var LastSeen_WithinAWeek: String { return self._s[1816]! } + public var ChannelMembers_GroupAdminsTitle: String { return self._s[1817]! } + public var Conversation_CloudStorage_ChatStatus: String { return self._s[1819]! } + public var Passport_Address_TypeResidentialAddress: String { return self._s[1820]! } + public var Conversation_StatusLeftGroup: String { return self._s[1821]! } + public var SocksProxySetup_ProxyDetailsTitle: String { return self._s[1822]! } + public var PhotoEditor_BlurToolRadial: String { return self._s[1825]! } + public var Conversation_ContextMenuCopy: String { return self._s[1826]! } + public var AccessDenied_CallMicrophone: String { return self._s[1827]! } public func Time_PreciseDate_m2(_ _1: String, _ _2: String, _ _3: String) -> (String, [(Int, NSRange)]) { - return formatWithArgumentRanges(self._s[1830]!, self._r[1830]!, [_1, _2, _3]) + return formatWithArgumentRanges(self._s[1828]!, self._r[1828]!, [_1, _2, _3]) } - public var Login_InvalidFirstNameError: String { return self._s[1831]! } - public var Notifications_Badge_CountUnreadMessages_InfoOn: String { return self._s[1832]! } - public var Checkout_PaymentMethod_New: String { return self._s[1833]! } - public var ShareMenu_CopyShareLinkGame: String { return self._s[1834]! } - public var PhotoEditor_QualityTool: String { return self._s[1835]! } - public var Login_SendCodeViaSms: String { return self._s[1836]! } + public var Login_InvalidFirstNameError: String { return self._s[1829]! } + public var Notifications_Badge_CountUnreadMessages_InfoOn: String { return self._s[1830]! } + public var Checkout_PaymentMethod_New: String { return self._s[1831]! } + public var ShareMenu_CopyShareLinkGame: String { return self._s[1832]! } + public var PhotoEditor_QualityTool: String { return self._s[1833]! } + public var Login_SendCodeViaSms: String { return self._s[1834]! } public func CHAT_MESSAGE_CONTACT(_ _1: String, _ _2: String) -> (String, [(Int, NSRange)]) { - return formatWithArgumentRanges(self._s[1837]!, self._r[1837]!, [_1, _2]) + return formatWithArgumentRanges(self._s[1835]!, self._r[1835]!, [_1, _2]) } - public var Login_EmailNotConfiguredError: String { return self._s[1838]! } - public var PrivacyPolicy_Accept: String { return self._s[1839]! } - public var Notifications_ExceptionsMessagePlaceholder: String { return self._s[1840]! } - public var InfoPlist_NSLocationAlwaysUsageDescription: String { return self._s[1841]! } - public var AutoNightTheme_Automatic: String { return self._s[1842]! } - public var Channel_Username_InvalidStartsWithNumber: String { return self._s[1843]! } - public var Privacy_ContactsSyncHelp: String { return self._s[1844]! } - public var Cache_Help: String { return self._s[1845]! } - public var Passport_Language_fa: String { return self._s[1846]! } - public var Login_ResetAccountProtected_TimerTitle: String { return self._s[1847]! } - public var PrivacySettings_LastSeen: String { return self._s[1848]! } + public var Login_EmailNotConfiguredError: String { return self._s[1836]! } + public var PrivacyPolicy_Accept: String { return self._s[1837]! } + public var Notifications_ExceptionsMessagePlaceholder: String { return self._s[1838]! } + public var InfoPlist_NSLocationAlwaysUsageDescription: String { return self._s[1839]! } + public var AutoNightTheme_Automatic: String { return self._s[1840]! } + public var Channel_Username_InvalidStartsWithNumber: String { return self._s[1841]! } + public var Privacy_ContactsSyncHelp: String { return self._s[1842]! } + public var Cache_Help: String { return self._s[1843]! } + public var Passport_Language_fa: String { return self._s[1844]! } + public var Login_ResetAccountProtected_TimerTitle: String { return self._s[1845]! } + public var PrivacySettings_LastSeen: String { return self._s[1846]! } public func DialogList_MultipleTyping(_ _0: String, _ _1: String) -> (String, [(Int, NSRange)]) { - return formatWithArgumentRanges(self._s[1849]!, self._r[1849]!, [_0, _1]) + return formatWithArgumentRanges(self._s[1847]!, self._r[1847]!, [_0, _1]) } - public var Channel_EditAdmin_PermissionInviteUsers: String { return self._s[1850]! } - public var Preview_SaveGif: String { return self._s[1852]! } - public var Profile_About: String { return self._s[1853]! } - public var Channel_About_Placeholder: String { return self._s[1854]! } - public var Login_InfoTitle: String { return self._s[1855]! } + public var Channel_EditAdmin_PermissionInviteUsers: String { return self._s[1848]! } + public var Preview_SaveGif: String { return self._s[1850]! } + public var Profile_About: String { return self._s[1851]! } + public var Channel_About_Placeholder: String { return self._s[1852]! } + public var Login_InfoTitle: String { return self._s[1853]! } public func TwoStepAuth_SetupPendingEmail(_ _0: String) -> (String, [(Int, NSRange)]) { - return formatWithArgumentRanges(self._s[1856]!, self._r[1856]!, [_0]) + return formatWithArgumentRanges(self._s[1854]!, self._r[1854]!, [_0]) } - public var Watch_Suggestion_CantTalk: String { return self._s[1858]! } - public var ContactInfo_Title: String { return self._s[1859]! } - public var Media_ShareThisVideo: String { return self._s[1860]! } - public var Weekday_ShortFriday: String { return self._s[1861]! } - public var AccessDenied_Contacts: String { return self._s[1862]! } - public var Notification_CallIncomingShort: String { return self._s[1863]! } - public var Group_Setup_TypePublic: String { return self._s[1864]! } - public var Notifications_MessageNotificationsExceptions: String { return self._s[1865]! } - public var Notifications_Badge_IncludeChannels: String { return self._s[1866]! } - public var Notifications_MessageNotificationsPreview: String { return self._s[1869]! } - public var ConversationProfile_ErrorCreatingConversation: String { return self._s[1870]! } - public var Group_ErrorAddTooMuchBots: String { return self._s[1871]! } - public var Privacy_GroupsAndChannels_CustomShareHelp: String { return self._s[1872]! } - public var DialogList_Typing: String { return self._s[1873]! } - public var Checkout_Phone: String { return self._s[1876]! } - public var Login_InfoFirstNamePlaceholder: String { return self._s[1879]! } - public var Privacy_Calls_Integration: String { return self._s[1880]! } - public var Notifications_PermissionsAllow: String { return self._s[1881]! } - public var TwoStepAuth_AddHintDescription: String { return self._s[1885]! } - public var Settings_ChatSettings: String { return self._s[1886]! } + public var Watch_Suggestion_CantTalk: String { return self._s[1856]! } + public var ContactInfo_Title: String { return self._s[1857]! } + public var Media_ShareThisVideo: String { return self._s[1858]! } + public var Weekday_ShortFriday: String { return self._s[1859]! } + public var AccessDenied_Contacts: String { return self._s[1860]! } + public var Notification_CallIncomingShort: String { return self._s[1861]! } + public var Group_Setup_TypePublic: String { return self._s[1862]! } + public var Notifications_MessageNotificationsExceptions: String { return self._s[1863]! } + public var Notifications_Badge_IncludeChannels: String { return self._s[1864]! } + public var Notifications_MessageNotificationsPreview: String { return self._s[1867]! } + public var ConversationProfile_ErrorCreatingConversation: String { return self._s[1868]! } + public var Group_ErrorAddTooMuchBots: String { return self._s[1869]! } + public var Privacy_GroupsAndChannels_CustomShareHelp: String { return self._s[1870]! } + public var Permissions_CellularDataAllowInSettings_v0: String { return self._s[1871]! } + public var DialogList_Typing: String { return self._s[1872]! } + public var Checkout_Phone: String { return self._s[1875]! } + public var Login_InfoFirstNamePlaceholder: String { return self._s[1878]! } + public var Privacy_Calls_Integration: String { return self._s[1879]! } + public var Notifications_PermissionsAllow: String { return self._s[1880]! } + public var TwoStepAuth_AddHintDescription: String { return self._s[1884]! } + public var Settings_ChatSettings: String { return self._s[1885]! } public func Channel_AdminLog_MessageInvitedNameUsername(_ _1: String, _ _2: String) -> (String, [(Int, NSRange)]) { - return formatWithArgumentRanges(self._s[1887]!, self._r[1887]!, [_1, _2]) + return formatWithArgumentRanges(self._s[1886]!, self._r[1886]!, [_1, _2]) } - public var Login_ContinueWithLocalization: String { return self._s[1889]! } - public var Watch_Message_ForwardedFrom: String { return self._s[1890]! } - public var TwoStepAuth_EnterEmailCode: String { return self._s[1892]! } - public var Conversation_Unblock: String { return self._s[1893]! } - public var PrivacySettings_DataSettings: String { return self._s[1894]! } - public var Notifications_InAppNotificationsVibrate: String { return self._s[1895]! } + public var Login_ContinueWithLocalization: String { return self._s[1888]! } + public var Watch_Message_ForwardedFrom: String { return self._s[1889]! } + public var TwoStepAuth_EnterEmailCode: String { return self._s[1891]! } + public var Conversation_Unblock: String { return self._s[1892]! } + public var PrivacySettings_DataSettings: String { return self._s[1893]! } + public var Notifications_InAppNotificationsVibrate: String { return self._s[1894]! } public func Privacy_GroupsAndChannels_InviteToChannelError(_ _0: String, _ _1: String) -> (String, [(Int, NSRange)]) { - return formatWithArgumentRanges(self._s[1896]!, self._r[1896]!, [_0, _1]) + return formatWithArgumentRanges(self._s[1895]!, self._r[1895]!, [_0, _1]) } - public var PrivacySettings_Passcode: String { return self._s[1899]! } + public var PrivacySettings_Passcode: String { return self._s[1898]! } public func ENCRYPTION_ACCEPT(_ _1: String) -> (String, [(Int, NSRange)]) { - return formatWithArgumentRanges(self._s[1900]!, self._r[1900]!, [_1]) + return formatWithArgumentRanges(self._s[1899]!, self._r[1899]!, [_1]) } - public var Passport_Language_dz: String { return self._s[1901]! } - public var Passport_Language_tk: String { return self._s[1902]! } + public var Passport_Language_dz: String { return self._s[1900]! } + public var Passport_Language_tk: String { return self._s[1901]! } public func Login_EmailCodeSubject(_ _0: String) -> (String, [(Int, NSRange)]) { - return formatWithArgumentRanges(self._s[1903]!, self._r[1903]!, [_0]) + return formatWithArgumentRanges(self._s[1902]!, self._r[1902]!, [_0]) } - public var InfoPlist_NSPhotoLibraryUsageDescription: String { return self._s[1904]! } - public var Conversation_ContextMenuReply: String { return self._s[1905]! } - public var Tour_Title1: String { return self._s[1906]! } + public var InfoPlist_NSPhotoLibraryUsageDescription: String { return self._s[1903]! } + public var Conversation_ContextMenuReply: String { return self._s[1904]! } + public var Tour_Title1: String { return self._s[1905]! } public func MESSAGE_STICKER(_ _1: String, _ _2: String) -> (String, [(Int, NSRange)]) { - return formatWithArgumentRanges(self._s[1907]!, self._r[1907]!, [_1, _2]) + return formatWithArgumentRanges(self._s[1906]!, self._r[1906]!, [_1, _2]) } - public var Conversation_ClearGroupHistory: String { return self._s[1909]! } + public var Conversation_ClearGroupHistory: String { return self._s[1908]! } public func Checkout_PasswordEntry_Text(_ _0: String) -> (String, [(Int, NSRange)]) { - return formatWithArgumentRanges(self._s[1910]!, self._r[1910]!, [_0]) + return formatWithArgumentRanges(self._s[1909]!, self._r[1909]!, [_0]) } - public var Call_RateCall: String { return self._s[1911]! } - public var Passport_PasswordCompleteSetup: String { return self._s[1912]! } - public var Conversation_InputTextSilentBroadcastPlaceholder: String { return self._s[1913]! } - public var UserInfo_LastNamePlaceholder: String { return self._s[1915]! } + public var Call_RateCall: String { return self._s[1910]! } + public var Passport_PasswordCompleteSetup: String { return self._s[1911]! } + public var Conversation_InputTextSilentBroadcastPlaceholder: String { return self._s[1912]! } + public var UserInfo_LastNamePlaceholder: String { return self._s[1914]! } public func Login_WillCallYou(_ _0: String) -> (String, [(Int, NSRange)]) { - return formatWithArgumentRanges(self._s[1917]!, self._r[1917]!, [_0]) + return formatWithArgumentRanges(self._s[1916]!, self._r[1916]!, [_0]) } - public var Compose_Create: String { return self._s[1918]! } - public var Contacts_InviteToTelegram: String { return self._s[1919]! } - public var GroupInfo_Notifications: String { return self._s[1920]! } - public var Message_PinnedLiveLocationMessage: String { return self._s[1922]! } - public var Month_GenApril: String { return self._s[1923]! } - public var Appearance_AutoNightTheme: String { return self._s[1924]! } - public var ChatSettings_AutomaticAudioDownload: String { return self._s[1926]! } - public var Login_CodeSentSms: String { return self._s[1928]! } + public var Compose_Create: String { return self._s[1917]! } + public var Contacts_InviteToTelegram: String { return self._s[1918]! } + public var GroupInfo_Notifications: String { return self._s[1919]! } + public var Message_PinnedLiveLocationMessage: String { return self._s[1921]! } + public var Month_GenApril: String { return self._s[1922]! } + public var Appearance_AutoNightTheme: String { return self._s[1923]! } + public var ChatSettings_AutomaticAudioDownload: String { return self._s[1925]! } + public var Login_CodeSentSms: String { return self._s[1927]! } public func UserInfo_UnblockConfirmation(_ _0: String) -> (String, [(Int, NSRange)]) { - return formatWithArgumentRanges(self._s[1929]!, self._r[1929]!, [_0]) + return formatWithArgumentRanges(self._s[1928]!, self._r[1928]!, [_0]) } - public var Passport_Language_hr: String { return self._s[1930]! } + public var Passport_Language_hr: String { return self._s[1929]! } public func Channel_AdminLog_MessageRestrictedNewSetting(_ _0: String) -> (String, [(Int, NSRange)]) { - return formatWithArgumentRanges(self._s[1931]!, self._r[1931]!, [_0]) + return formatWithArgumentRanges(self._s[1930]!, self._r[1930]!, [_0]) } - public var GroupInfo_InviteLink_CopyLink: String { return self._s[1932]! } - public var Conversation_InputTextBroadcastPlaceholder: String { return self._s[1933]! } - public var Privacy_SecretChatsTitle: String { return self._s[1934]! } - public var Notification_SecretChatMessageScreenshotSelf: String { return self._s[1936]! } - public var GroupInfo_AddUserLeftError: String { return self._s[1937]! } - public var Preview_DeleteGif: String { return self._s[1938]! } - public var Permissions_ContactsText: String { return self._s[1939]! } - public var Group_ErrorNotMutualContact: String { return self._s[1940]! } - public var Notification_MessageLifetime5s: String { return self._s[1941]! } + public var GroupInfo_InviteLink_CopyLink: String { return self._s[1931]! } + public var Conversation_InputTextBroadcastPlaceholder: String { return self._s[1932]! } + public var Privacy_SecretChatsTitle: String { return self._s[1933]! } + public var Notification_SecretChatMessageScreenshotSelf: String { return self._s[1935]! } + public var GroupInfo_AddUserLeftError: String { return self._s[1936]! } + public var Preview_DeleteGif: String { return self._s[1937]! } + public var Group_ErrorNotMutualContact: String { return self._s[1938]! } + public var Notification_MessageLifetime5s: String { return self._s[1939]! } public func Watch_LastSeen_AtDate(_ _0: String) -> (String, [(Int, NSRange)]) { - return formatWithArgumentRanges(self._s[1942]!, self._r[1942]!, [_0]) + return formatWithArgumentRanges(self._s[1940]!, self._r[1940]!, [_0]) } - public var Passport_Address_AddBankStatement: String { return self._s[1944]! } - public var Notification_CallIncoming: String { return self._s[1945]! } - public var TwoStepAuth_RecoveryCodeHelp: String { return self._s[1947]! } - public var Passport_Address_Postcode: String { return self._s[1949]! } + public var Passport_Address_AddBankStatement: String { return self._s[1942]! } + public var Notification_CallIncoming: String { return self._s[1943]! } + public var TwoStepAuth_RecoveryCodeHelp: String { return self._s[1945]! } + public var Passport_Address_Postcode: String { return self._s[1947]! } public func LastSeen_YesterdayAt(_ _0: String) -> (String, [(Int, NSRange)]) { + return formatWithArgumentRanges(self._s[1948]!, self._r[1948]!, [_0]) + } + public var Checkout_NewCard_SaveInfoHelp: String { return self._s[1949]! } + public func Cache_Clear(_ _0: String) -> (String, [(Int, NSRange)]) { return formatWithArgumentRanges(self._s[1950]!, self._r[1950]!, [_0]) } - public var Checkout_NewCard_SaveInfoHelp: String { return self._s[1951]! } - public func Cache_Clear(_ _0: String) -> (String, [(Int, NSRange)]) { - return formatWithArgumentRanges(self._s[1952]!, self._r[1952]!, [_0]) - } - public var Bot_GroupStatusDoesNotReadHistory: String { return self._s[1953]! } - public var Username_Placeholder: String { return self._s[1954]! } - public var Passport_FieldAddressUploadHelp: String { return self._s[1955]! } - public var Passport_PasswordDescription: String { return self._s[1957]! } - public var Channel_MessagePhotoUpdated: String { return self._s[1958]! } - public var MediaPicker_TapToUngroupDescription: String { return self._s[1959]! } - public var AttachmentMenu_PhotoOrVideo: String { return self._s[1960]! } - public var Conversation_ContextMenuMore: String { return self._s[1961]! } - public var Privacy_PaymentsClearInfo: String { return self._s[1962]! } - public var CallSettings_TabIcon: String { return self._s[1963]! } - public var KeyCommand_Find: String { return self._s[1964]! } - public var Message_PinnedGame: String { return self._s[1965]! } - public var Notifications_Badge_CountUnreadMessages_InfoOff: String { return self._s[1966]! } - public var Login_CallRequestState2: String { return self._s[1968]! } - public var CheckoutInfo_ReceiverInfoNamePlaceholder: String { return self._s[1970]! } + public var Bot_GroupStatusDoesNotReadHistory: String { return self._s[1951]! } + public var Username_Placeholder: String { return self._s[1952]! } + public var Passport_FieldAddressUploadHelp: String { return self._s[1953]! } + public var Permissions_NotificationsAllowInSettings_v0: String { return self._s[1954]! } + public var Passport_PasswordDescription: String { return self._s[1956]! } + public var Channel_MessagePhotoUpdated: String { return self._s[1957]! } + public var MediaPicker_TapToUngroupDescription: String { return self._s[1958]! } + public var AttachmentMenu_PhotoOrVideo: String { return self._s[1959]! } + public var Conversation_ContextMenuMore: String { return self._s[1960]! } + public var Privacy_PaymentsClearInfo: String { return self._s[1961]! } + public var CallSettings_TabIcon: String { return self._s[1962]! } + public var KeyCommand_Find: String { return self._s[1963]! } + public var Message_PinnedGame: String { return self._s[1964]! } + public var Notifications_Badge_CountUnreadMessages_InfoOff: String { return self._s[1965]! } + public var Login_CallRequestState2: String { return self._s[1967]! } + public var CheckoutInfo_ReceiverInfoNamePlaceholder: String { return self._s[1969]! } public func Checkout_PayPrice(_ _0: String) -> (String, [(Int, NSRange)]) { - return formatWithArgumentRanges(self._s[1972]!, self._r[1972]!, [_0]) + return formatWithArgumentRanges(self._s[1971]!, self._r[1971]!, [_0]) } - public var Conversation_InstantPagePreview: String { return self._s[1973]! } + public var Conversation_InstantPagePreview: String { return self._s[1972]! } public func DialogList_SingleUploadingVideoSuffix(_ _0: String) -> (String, [(Int, NSRange)]) { - return formatWithArgumentRanges(self._s[1974]!, self._r[1974]!, [_0]) + return formatWithArgumentRanges(self._s[1973]!, self._r[1973]!, [_0]) } - public var SecretTimer_VideoDescription: String { return self._s[1977]! } - public var Passport_Language_es: String { return self._s[1978]! } + public var SecretTimer_VideoDescription: String { return self._s[1976]! } + public var Passport_Language_es: String { return self._s[1977]! } + public var Permissions_ContactsAllow_v0: String { return self._s[1979]! } public var Conversation_EditingMessageMediaEditCurrentVideo: String { return self._s[1980]! } public var WebPreview_GettingLinkInfo: String { return self._s[1981]! } public var Watch_UserInfo_Unmute: String { return self._s[1982]! } @@ -2386,1121 +2388,1125 @@ public final class PresentationStrings { } public var Cache_ClearCache: String { return self._s[2071]! } public var AutoNightTheme_UpdateLocation: String { return self._s[2072]! } + public var Permissions_NotificationsUnreachableText_v0: String { return self._s[2073]! } public func Channel_AdminLog_MessageChangedGroupUsername(_ _0: String) -> (String, [(Int, NSRange)]) { - return formatWithArgumentRanges(self._s[2074]!, self._r[2074]!, [_0]) + return formatWithArgumentRanges(self._s[2075]!, self._r[2075]!, [_0]) } - public var Channel_AdminLog_EmptyFilterTitle: String { return self._s[2076]! } - public var SocksProxySetup_TypeSocks: String { return self._s[2077]! } - public var AutoNightTheme_Title: String { return self._s[2078]! } - public var InstantPage_FeedbackButton: String { return self._s[2079]! } - public var Passport_FieldAddress: String { return self._s[2080]! } - public var Month_ShortMarch: String { return self._s[2081]! } - public var SocksProxySetup_UsernamePlaceholder: String { return self._s[2082]! } - public var Conversation_ShareInlineBotLocationConfirmation: String { return self._s[2083]! } - public var Passport_FloodError: String { return self._s[2084]! } - public var Passport_Language_th: String { return self._s[2086]! } - public var Passport_Address_Address: String { return self._s[2087]! } - public var Login_InvalidLastNameError: String { return self._s[2088]! } - public var Notifications_InAppNotificationsPreview: String { return self._s[2089]! } - public var ShareMenu_Send: String { return self._s[2090]! } - public var Month_GenNovember: String { return self._s[2093]! } - public var Checkout_Email: String { return self._s[2095]! } - public var NotificationsSound_Tritone: String { return self._s[2096]! } - public var StickerPacksSettings_ManagingHelp: String { return self._s[2098]! } - public var ChangePhoneNumberNumber_Help: String { return self._s[2101]! } + public var Channel_AdminLog_EmptyFilterTitle: String { return self._s[2077]! } + public var SocksProxySetup_TypeSocks: String { return self._s[2078]! } + public var AutoNightTheme_Title: String { return self._s[2079]! } + public var InstantPage_FeedbackButton: String { return self._s[2080]! } + public var Passport_FieldAddress: String { return self._s[2081]! } + public var Month_ShortMarch: String { return self._s[2082]! } + public var SocksProxySetup_UsernamePlaceholder: String { return self._s[2083]! } + public var Conversation_ShareInlineBotLocationConfirmation: String { return self._s[2084]! } + public var Passport_FloodError: String { return self._s[2085]! } + public var Passport_Language_th: String { return self._s[2087]! } + public var Passport_Address_Address: String { return self._s[2088]! } + public var Login_InvalidLastNameError: String { return self._s[2089]! } + public var Notifications_InAppNotificationsPreview: String { return self._s[2090]! } + public var ShareMenu_Send: String { return self._s[2091]! } + public var Month_GenNovember: String { return self._s[2094]! } + public var Checkout_Email: String { return self._s[2096]! } + public var NotificationsSound_Tritone: String { return self._s[2097]! } + public var StickerPacksSettings_ManagingHelp: String { return self._s[2099]! } + public var ChangePhoneNumberNumber_Help: String { return self._s[2102]! } public func Checkout_LiabilityAlert(_ _1: String, _ _2: String) -> (String, [(Int, NSRange)]) { - return formatWithArgumentRanges(self._s[2102]!, self._r[2102]!, [_1, _1, _1, _2]) + return formatWithArgumentRanges(self._s[2103]!, self._r[2103]!, [_1, _1, _1, _2]) } - public var DialogList_You: String { return self._s[2103]! } - public var MediaPicker_Send: String { return self._s[2106]! } - public var Call_AudioRouteSpeaker: String { return self._s[2107]! } - public var Watch_UserInfo_Title: String { return self._s[2108]! } - public var Appearance_AccentColor: String { return self._s[2109]! } + public var DialogList_You: String { return self._s[2104]! } + public var MediaPicker_Send: String { return self._s[2107]! } + public var Call_AudioRouteSpeaker: String { return self._s[2108]! } + public var Watch_UserInfo_Title: String { return self._s[2109]! } + public var Appearance_AccentColor: String { return self._s[2110]! } public func Login_EmailPhoneSubject(_ _0: String) -> (String, [(Int, NSRange)]) { - return formatWithArgumentRanges(self._s[2110]!, self._r[2110]!, [_0]) + return formatWithArgumentRanges(self._s[2111]!, self._r[2111]!, [_0]) } - public var Conversation_ClousStorageInfo_Description2: String { return self._s[2111]! } - public var WebSearch_RecentClearConfirmation: String { return self._s[2112]! } - public var Notification_CallOutgoing: String { return self._s[2113]! } - public var PrivacySettings_PasscodeAndFaceId: String { return self._s[2114]! } - public var Call_RecordingDisabledMessage: String { return self._s[2115]! } - public var PrivacyLastSeenSettings_CustomHelp: String { return self._s[2116]! } - public var Channel_EditAdmin_PermissionAddAdmins: String { return self._s[2117]! } - public var Date_DialogDateFormat: String { return self._s[2118]! } - public var Notifications_InAppNotifications: String { return self._s[2119]! } + public var Permissions_ContactsAllowInSettings_v0: String { return self._s[2112]! } + public var Conversation_ClousStorageInfo_Description2: String { return self._s[2113]! } + public var WebSearch_RecentClearConfirmation: String { return self._s[2114]! } + public var Notification_CallOutgoing: String { return self._s[2115]! } + public var PrivacySettings_PasscodeAndFaceId: String { return self._s[2116]! } + public var Call_RecordingDisabledMessage: String { return self._s[2117]! } + public var PrivacyLastSeenSettings_CustomHelp: String { return self._s[2118]! } + public var Channel_EditAdmin_PermissionAddAdmins: String { return self._s[2119]! } + public var Date_DialogDateFormat: String { return self._s[2120]! } + public var Notifications_InAppNotifications: String { return self._s[2121]! } public func Settings_ApplyProxyAlert(_ _1: String, _ _2: String) -> (String, [(Int, NSRange)]) { - return formatWithArgumentRanges(self._s[2120]!, self._r[2120]!, [_1, _2]) + return formatWithArgumentRanges(self._s[2122]!, self._r[2122]!, [_1, _2]) } - public var NewContact_Title: String { return self._s[2121]! } - public var Conversation_ViewContactDetails: String { return self._s[2122]! } - public var Checkout_NewCard_CardholderNameTitle: String { return self._s[2123]! } - public var Passport_Identity_ExpiryDateNone: String { return self._s[2124]! } - public var PrivacySettings_Title: String { return self._s[2125]! } - public var Conversation_SilentBroadcastTooltipOff: String { return self._s[2128]! } + public var NewContact_Title: String { return self._s[2123]! } + public var Conversation_ViewContactDetails: String { return self._s[2124]! } + public var Checkout_NewCard_CardholderNameTitle: String { return self._s[2125]! } + public var Passport_Identity_ExpiryDateNone: String { return self._s[2126]! } + public var PrivacySettings_Title: String { return self._s[2127]! } + public var Conversation_SilentBroadcastTooltipOff: String { return self._s[2130]! } public func CHANNEL_MESSAGE_CONTACT(_ _1: String) -> (String, [(Int, NSRange)]) { - return formatWithArgumentRanges(self._s[2129]!, self._r[2129]!, [_1]) + return formatWithArgumentRanges(self._s[2131]!, self._r[2131]!, [_1]) } - public var Contacts_PhoneNumber: String { return self._s[2130]! } - public var Map_ShowPlaces: String { return self._s[2132]! } - public var ChatAdmins_Title: String { return self._s[2133]! } - public var InstantPage_Reference: String { return self._s[2135]! } - public var Camera_FlashOff: String { return self._s[2136]! } - public var Watch_UserInfo_Block: String { return self._s[2137]! } - public var ChatSettings_Stickers: String { return self._s[2138]! } + public var Contacts_PhoneNumber: String { return self._s[2132]! } + public var Map_ShowPlaces: String { return self._s[2134]! } + public var ChatAdmins_Title: String { return self._s[2135]! } + public var InstantPage_Reference: String { return self._s[2137]! } + public var Camera_FlashOff: String { return self._s[2138]! } + public var Watch_UserInfo_Block: String { return self._s[2139]! } + public var ChatSettings_Stickers: String { return self._s[2140]! } public func UserInfo_BlockConfirmation(_ _0: String) -> (String, [(Int, NSRange)]) { - return formatWithArgumentRanges(self._s[2139]!, self._r[2139]!, [_0]) + return formatWithArgumentRanges(self._s[2141]!, self._r[2141]!, [_0]) } - public var Login_CheckOtherSessionMessages: String { return self._s[2140]! } - public var Settings_ViewPhoto: String { return self._s[2141]! } - public var AutoDownloadSettings_Cellular: String { return self._s[2142]! } + public var Login_CheckOtherSessionMessages: String { return self._s[2142]! } + public var Settings_ViewPhoto: String { return self._s[2143]! } + public var AutoDownloadSettings_Cellular: String { return self._s[2144]! } public func Target_InviteToGroupConfirmation(_ _0: String) -> (String, [(Int, NSRange)]) { - return formatWithArgumentRanges(self._s[2144]!, self._r[2144]!, [_0]) - } - public var Privacy_DeleteDrafts: String { return self._s[2145]! } - public func LastSeen_AtDate(_ _0: String) -> (String, [(Int, NSRange)]) { return formatWithArgumentRanges(self._s[2146]!, self._r[2146]!, [_0]) } - public var DialogList_SavedMessagesHelp: String { return self._s[2147]! } - public var DialogList_SavedMessages: String { return self._s[2148]! } - public var GroupInfo_UpgradeButton: String { return self._s[2149]! } + public var Privacy_DeleteDrafts: String { return self._s[2147]! } + public func LastSeen_AtDate(_ _0: String) -> (String, [(Int, NSRange)]) { + return formatWithArgumentRanges(self._s[2148]!, self._r[2148]!, [_0]) + } + public var DialogList_SavedMessagesHelp: String { return self._s[2149]! } + public var DialogList_SavedMessages: String { return self._s[2150]! } + public var GroupInfo_UpgradeButton: String { return self._s[2151]! } public func CHAT_MESSAGE_GAME(_ _1: String, _ _2: String, _ _3: String) -> (String, [(Int, NSRange)]) { - return formatWithArgumentRanges(self._s[2150]!, self._r[2150]!, [_1, _2, _3]) + return formatWithArgumentRanges(self._s[2152]!, self._r[2152]!, [_1, _2, _3]) } - public var DialogList_Pin: String { return self._s[2151]! } + public var DialogList_Pin: String { return self._s[2153]! } public func ForwardedAuthors2(_ _0: String, _ _1: String) -> (String, [(Int, NSRange)]) { - return formatWithArgumentRanges(self._s[2152]!, self._r[2152]!, [_0, _1]) + return formatWithArgumentRanges(self._s[2154]!, self._r[2154]!, [_0, _1]) } - public var Notification_Exceptions_AlwaysOn: String { return self._s[2153]! } - public var UserInfo_NotificationsDisable: String { return self._s[2154]! } - public var Paint_Outlined: String { return self._s[2155]! } - public var Activity_PlayingGame: String { return self._s[2156]! } - public var SearchImages_NoImagesFound: String { return self._s[2157]! } - public var SocksProxySetup_ProxyType: String { return self._s[2158]! } - public var AppleWatch_ReplyPresetsHelp: String { return self._s[2160]! } - public var Settings_AppLanguage: String { return self._s[2161]! } - public var TwoStepAuth_ResetAccountHelp: String { return self._s[2162]! } - public var Common_ChoosePhoto: String { return self._s[2163]! } - public var Privacy_Calls_AlwaysAllow: String { return self._s[2164]! } - public var Activity_UploadingVideo: String { return self._s[2165]! } - public var ChannelInfo_DeleteChannelConfirmation: String { return self._s[2166]! } - public var NetworkUsageSettings_Wifi: String { return self._s[2167]! } - public var Channel_BanUser_PermissionReadMessages: String { return self._s[2168]! } - public var Checkout_PayWithTouchId: String { return self._s[2169]! } - public var Notifications_ExceptionsNone: String { return self._s[2171]! } + public var Notification_Exceptions_AlwaysOn: String { return self._s[2155]! } + public var UserInfo_NotificationsDisable: String { return self._s[2156]! } + public var Paint_Outlined: String { return self._s[2157]! } + public var Activity_PlayingGame: String { return self._s[2158]! } + public var SearchImages_NoImagesFound: String { return self._s[2159]! } + public var SocksProxySetup_ProxyType: String { return self._s[2160]! } + public var AppleWatch_ReplyPresetsHelp: String { return self._s[2162]! } + public var Settings_AppLanguage: String { return self._s[2163]! } + public var TwoStepAuth_ResetAccountHelp: String { return self._s[2164]! } + public var Common_ChoosePhoto: String { return self._s[2165]! } + public var Privacy_Calls_AlwaysAllow: String { return self._s[2166]! } + public var Activity_UploadingVideo: String { return self._s[2167]! } + public var ChannelInfo_DeleteChannelConfirmation: String { return self._s[2168]! } + public var NetworkUsageSettings_Wifi: String { return self._s[2169]! } + public var Channel_BanUser_PermissionReadMessages: String { return self._s[2170]! } + public var Checkout_PayWithTouchId: String { return self._s[2171]! } + public var Notifications_ExceptionsNone: String { return self._s[2173]! } public func Message_ForwardedMessageShort(_ _0: String) -> (String, [(Int, NSRange)]) { - return formatWithArgumentRanges(self._s[2172]!, self._r[2172]!, [_0]) + return formatWithArgumentRanges(self._s[2174]!, self._r[2174]!, [_0]) } - public var AuthSessions_IncompleteAttempts: String { return self._s[2173]! } - public var Passport_Address_Region: String { return self._s[2177]! } - public var PhotoEditor_TiltShift: String { return self._s[2178]! } - public var Settings_FAQ_URL: String { return self._s[2179]! } - public var Passport_Language_sl: String { return self._s[2180]! } - public var Settings_PrivacySettings: String { return self._s[2182]! } - public var SharedMedia_TitleLink: String { return self._s[2183]! } - public var Passport_Identity_TypePassportUploadScan: String { return self._s[2184]! } - public var Settings_SetProfilePhoto: String { return self._s[2185]! } - public var Channel_About_Help: String { return self._s[2186]! } - public var AttachmentMenu_SendAsFiles: String { return self._s[2187]! } - public var Passport_Address_AddTemporaryRegistration: String { return self._s[2189]! } - public var PrivacySettings_DeleteAccountTitle: String { return self._s[2190]! } - public var AccessDenied_VideoMessageCamera: String { return self._s[2192]! } - public var Map_OpenInYandexMaps: String { return self._s[2194]! } - public var PhotoEditor_SaturationTool: String { return self._s[2195]! } - public var Notification_Exceptions_NewException_NotificationHeader: String { return self._s[2196]! } - public var Appearance_TextSize: String { return self._s[2197]! } - public var Channel_Username_InvalidTooShort: String { return self._s[2199]! } - public var Passport_PassportInformation: String { return self._s[2202]! } - public var WatchRemote_AlertTitle: String { return self._s[2203]! } - public var Privacy_GroupsAndChannels_NeverAllow: String { return self._s[2204]! } - public var ConvertToSupergroup_HelpText: String { return self._s[2206]! } + public var AuthSessions_IncompleteAttempts: String { return self._s[2175]! } + public var Passport_Address_Region: String { return self._s[2179]! } + public var PhotoEditor_TiltShift: String { return self._s[2180]! } + public var Settings_FAQ_URL: String { return self._s[2181]! } + public var Passport_Language_sl: String { return self._s[2182]! } + public var Settings_PrivacySettings: String { return self._s[2184]! } + public var SharedMedia_TitleLink: String { return self._s[2185]! } + public var Passport_Identity_TypePassportUploadScan: String { return self._s[2186]! } + public var Settings_SetProfilePhoto: String { return self._s[2187]! } + public var Channel_About_Help: String { return self._s[2188]! } + public var AttachmentMenu_SendAsFiles: String { return self._s[2189]! } + public var Passport_Address_AddTemporaryRegistration: String { return self._s[2191]! } + public var PrivacySettings_DeleteAccountTitle: String { return self._s[2192]! } + public var AccessDenied_VideoMessageCamera: String { return self._s[2194]! } + public var Map_OpenInYandexMaps: String { return self._s[2196]! } + public var PhotoEditor_SaturationTool: String { return self._s[2197]! } + public var Notification_Exceptions_NewException_NotificationHeader: String { return self._s[2198]! } + public var Appearance_TextSize: String { return self._s[2199]! } + public var Channel_Username_InvalidTooShort: String { return self._s[2201]! } + public var Passport_PassportInformation: String { return self._s[2204]! } + public var WatchRemote_AlertTitle: String { return self._s[2205]! } + public var Privacy_GroupsAndChannels_NeverAllow: String { return self._s[2206]! } + public var ConvertToSupergroup_HelpText: String { return self._s[2208]! } public func Time_MonthOfYear_m7(_ _0: String) -> (String, [(Int, NSRange)]) { - return formatWithArgumentRanges(self._s[2207]!, self._r[2207]!, [_0]) + return formatWithArgumentRanges(self._s[2209]!, self._r[2209]!, [_0]) } - public var Privacy_GroupsAndChannels_CustomHelp: String { return self._s[2208]! } - public var TwoStepAuth_RecoveryCodeInvalid: String { return self._s[2210]! } - public var AccessDenied_CameraDisabled: String { return self._s[2211]! } + public var Privacy_GroupsAndChannels_CustomHelp: String { return self._s[2210]! } + public var TwoStepAuth_RecoveryCodeInvalid: String { return self._s[2212]! } + public var AccessDenied_CameraDisabled: String { return self._s[2213]! } public func Channel_Username_UsernameIsAvailable(_ _0: String) -> (String, [(Int, NSRange)]) { - return formatWithArgumentRanges(self._s[2212]!, self._r[2212]!, [_0]) + return formatWithArgumentRanges(self._s[2214]!, self._r[2214]!, [_0]) } - public var PhotoEditor_ContrastTool: String { return self._s[2215]! } - public var DialogList_Draft: String { return self._s[2216]! } - public var Privacy_TopPeersDelete: String { return self._s[2218]! } - public var LoginPassword_PasswordPlaceholder: String { return self._s[2219]! } - public var Passport_Identity_TypeIdentityCardUploadScan: String { return self._s[2220]! } - public var WebSearch_RecentSectionClear: String { return self._s[2221]! } - public var Watch_ChatList_NoConversationsTitle: String { return self._s[2223]! } - public var Common_Done: String { return self._s[2224]! } - public var AuthSessions_EmptyText: String { return self._s[2225]! } - public var Conversation_ShareBotContactConfirmation: String { return self._s[2226]! } - public var Tour_Title5: String { return self._s[2227]! } + public var PhotoEditor_ContrastTool: String { return self._s[2217]! } + public var DialogList_Draft: String { return self._s[2218]! } + public var Privacy_TopPeersDelete: String { return self._s[2220]! } + public var LoginPassword_PasswordPlaceholder: String { return self._s[2221]! } + public var Passport_Identity_TypeIdentityCardUploadScan: String { return self._s[2222]! } + public var WebSearch_RecentSectionClear: String { return self._s[2223]! } + public var Watch_ChatList_NoConversationsTitle: String { return self._s[2225]! } + public var Common_Done: String { return self._s[2226]! } + public var AuthSessions_EmptyText: String { return self._s[2227]! } + public var Conversation_ShareBotContactConfirmation: String { return self._s[2228]! } + public var Tour_Title5: String { return self._s[2229]! } public func Map_DirectionsDriveEta(_ _0: String) -> (String, [(Int, NSRange)]) { - return formatWithArgumentRanges(self._s[2228]!, self._r[2228]!, [_0]) + return formatWithArgumentRanges(self._s[2230]!, self._r[2230]!, [_0]) } - public var ApplyLanguage_UnsufficientDataTitle: String { return self._s[2229]! } - public var Conversation_LinkDialogSave: String { return self._s[2230]! } - public var GroupInfo_ActionRestrict: String { return self._s[2231]! } - public var Checkout_Title: String { return self._s[2232]! } - public var Channel_AdminLog_CanChangeInfo: String { return self._s[2235]! } - public var Notification_RenamedGroup: String { return self._s[2236]! } - public var Checkout_PayWithFaceId: String { return self._s[2237]! } - public var Channel_BanList_BlockedTitle: String { return self._s[2238]! } - public var Checkout_WebConfirmation_Title: String { return self._s[2240]! } - public var Notifications_MessageNotificationsAlert: String { return self._s[2241]! } - public var Profile_AddToExisting: String { return self._s[2243]! } + public var ApplyLanguage_UnsufficientDataTitle: String { return self._s[2231]! } + public var Conversation_LinkDialogSave: String { return self._s[2232]! } + public var GroupInfo_ActionRestrict: String { return self._s[2233]! } + public var Checkout_Title: String { return self._s[2234]! } + public var Channel_AdminLog_CanChangeInfo: String { return self._s[2237]! } + public var Notification_RenamedGroup: String { return self._s[2238]! } + public var Checkout_PayWithFaceId: String { return self._s[2239]! } + public var Channel_BanList_BlockedTitle: String { return self._s[2240]! } + public var Checkout_WebConfirmation_Title: String { return self._s[2242]! } + public var Notifications_MessageNotificationsAlert: String { return self._s[2243]! } + public var Profile_AddToExisting: String { return self._s[2245]! } public func Profile_CreateEncryptedChatOutdatedError(_ _0: String, _ _1: String) -> (String, [(Int, NSRange)]) { - return formatWithArgumentRanges(self._s[2244]!, self._r[2244]!, [_0, _1]) + return formatWithArgumentRanges(self._s[2246]!, self._r[2246]!, [_0, _1]) } - public var Cache_Files: String { return self._s[2245]! } - public var Permissions_PrivacyPolicy: String { return self._s[2246]! } - public var SocksProxySetup_ConnectAndSave: String { return self._s[2247]! } - public var UserInfo_NotificationsDefaultDisabled: String { return self._s[2248]! } - public var Calls_NoCallsPlaceholder: String { return self._s[2251]! } - public var Channel_Username_RevokeExistingUsernamesInfo: String { return self._s[2252]! } - public var Notifications_ExceptionsGroupPlaceholder: String { return self._s[2254]! } - public var Passport_FieldAddressHelp: String { return self._s[2255]! } - public var Privacy_GroupsAndChannels_InviteToChannelMultipleError: String { return self._s[2256]! } + public var Cache_Files: String { return self._s[2247]! } + public var Permissions_PrivacyPolicy: String { return self._s[2248]! } + public var SocksProxySetup_ConnectAndSave: String { return self._s[2249]! } + public var UserInfo_NotificationsDefaultDisabled: String { return self._s[2250]! } + public var Calls_NoCallsPlaceholder: String { return self._s[2253]! } + public var Channel_Username_RevokeExistingUsernamesInfo: String { return self._s[2254]! } + public var Notifications_ExceptionsGroupPlaceholder: String { return self._s[2256]! } + public var Passport_FieldAddressHelp: String { return self._s[2257]! } + public var Privacy_GroupsAndChannels_InviteToChannelMultipleError: String { return self._s[2258]! } public func Login_TermsOfService_ProceedBot(_ _0: String) -> (String, [(Int, NSRange)]) { - return formatWithArgumentRanges(self._s[2257]!, self._r[2257]!, [_0]) + return formatWithArgumentRanges(self._s[2259]!, self._r[2259]!, [_0]) } - public var Channel_AdminLog_EmptyTitle: String { return self._s[2258]! } - public var Privacy_Calls_NeverAllow_Title: String { return self._s[2260]! } - public var Login_UnknownError: String { return self._s[2261]! } - public var Group_UpgradeNoticeText2: String { return self._s[2263]! } - public var Watch_Compose_AddContact: String { return self._s[2264]! } - public var Web_Error: String { return self._s[2265]! } - public var Profile_MessageLifetime1h: String { return self._s[2266]! } - public var CheckoutInfo_ReceiverInfoEmailPlaceholder: String { return self._s[2267]! } - public var Channel_Username_CheckingUsername: String { return self._s[2268]! } + public var Channel_AdminLog_EmptyTitle: String { return self._s[2260]! } + public var Privacy_Calls_NeverAllow_Title: String { return self._s[2262]! } + public var Login_UnknownError: String { return self._s[2263]! } + public var Group_UpgradeNoticeText2: String { return self._s[2265]! } + public var Watch_Compose_AddContact: String { return self._s[2266]! } + public var Web_Error: String { return self._s[2267]! } + public var Profile_MessageLifetime1h: String { return self._s[2268]! } + public var CheckoutInfo_ReceiverInfoEmailPlaceholder: String { return self._s[2269]! } + public var Channel_Username_CheckingUsername: String { return self._s[2270]! } public func PINNED_GAME(_ _1: String) -> (String, [(Int, NSRange)]) { - return formatWithArgumentRanges(self._s[2269]!, self._r[2269]!, [_1]) + return formatWithArgumentRanges(self._s[2271]!, self._r[2271]!, [_1]) } - public var Channel_AboutItem: String { return self._s[2270]! } - public var Privacy_GroupsAndChannels_AlwaysAllow_Placeholder: String { return self._s[2272]! } - public var GroupInfo_SharedMedia: String { return self._s[2273]! } + public var Channel_AboutItem: String { return self._s[2272]! } + public var Privacy_GroupsAndChannels_AlwaysAllow_Placeholder: String { return self._s[2274]! } + public var GroupInfo_SharedMedia: String { return self._s[2275]! } public func Channel_AdminLog_MessagePromotedName(_ _1: String) -> (String, [(Int, NSRange)]) { - return formatWithArgumentRanges(self._s[2274]!, self._r[2274]!, [_1]) + return formatWithArgumentRanges(self._s[2276]!, self._r[2276]!, [_1]) } - public var Call_PhoneCallInProgressMessage: String { return self._s[2275]! } - public var GroupInfo_InviteLink_RevokeAlert_Text: String { return self._s[2276]! } - public var Conversation_SearchByName_Placeholder: String { return self._s[2277]! } - public var Group_UpgradeNoticeHeader: String { return self._s[2278]! } - public var Channel_Management_AddModerator: String { return self._s[2279]! } - public var StickerPacksSettings_ShowStickersButton: String { return self._s[2280]! } - public var NotificationsSound_Hello: String { return self._s[2281]! } + public var Call_PhoneCallInProgressMessage: String { return self._s[2277]! } + public var GroupInfo_InviteLink_RevokeAlert_Text: String { return self._s[2278]! } + public var Conversation_SearchByName_Placeholder: String { return self._s[2279]! } + public var Group_UpgradeNoticeHeader: String { return self._s[2280]! } + public var Channel_Management_AddModerator: String { return self._s[2281]! } + public var StickerPacksSettings_ShowStickersButton: String { return self._s[2282]! } + public var NotificationsSound_Hello: String { return self._s[2283]! } public func CHAT_MESSAGE_GEO(_ _1: String, _ _2: String) -> (String, [(Int, NSRange)]) { - return formatWithArgumentRanges(self._s[2282]!, self._r[2282]!, [_1, _2]) + return formatWithArgumentRanges(self._s[2284]!, self._r[2284]!, [_1, _2]) } - public var SocksProxySetup_SavedProxies: String { return self._s[2283]! } - public var Channel_Stickers_Placeholder: String { return self._s[2285]! } + public var SocksProxySetup_SavedProxies: String { return self._s[2285]! } + public var Channel_Stickers_Placeholder: String { return self._s[2287]! } public func Login_EmailCodeBody(_ _0: String) -> (String, [(Int, NSRange)]) { - return formatWithArgumentRanges(self._s[2286]!, self._r[2286]!, [_0]) + return formatWithArgumentRanges(self._s[2288]!, self._r[2288]!, [_0]) } - public var PrivacyPolicy_DeclineDeclineAndDelete: String { return self._s[2287]! } - public var Channel_Management_AddModeratorHelp: String { return self._s[2288]! } - public var ContactInfo_BirthdayLabel: String { return self._s[2289]! } - public var ChangePhoneNumberCode_RequestingACall: String { return self._s[2290]! } - public var AutoDownloadSettings_Channels: String { return self._s[2291]! } - public var Passport_Language_mn: String { return self._s[2292]! } - public var Notifications_ResetAllNotificationsHelp: String { return self._s[2295]! } - public var Passport_Language_ja: String { return self._s[2297]! } - public var Settings_About_Title: String { return self._s[2298]! } - public var Settings_NotificationsAndSounds: String { return self._s[2299]! } - public var ChannelInfo_DeleteGroup: String { return self._s[2300]! } - public var Settings_BlockedUsers: String { return self._s[2301]! } + public var PrivacyPolicy_DeclineDeclineAndDelete: String { return self._s[2289]! } + public var Channel_Management_AddModeratorHelp: String { return self._s[2290]! } + public var ContactInfo_BirthdayLabel: String { return self._s[2291]! } + public var ChangePhoneNumberCode_RequestingACall: String { return self._s[2292]! } + public var AutoDownloadSettings_Channels: String { return self._s[2293]! } + public var Passport_Language_mn: String { return self._s[2294]! } + public var Notifications_ResetAllNotificationsHelp: String { return self._s[2297]! } + public var Passport_Language_ja: String { return self._s[2299]! } + public var Settings_About_Title: String { return self._s[2300]! } + public var Settings_NotificationsAndSounds: String { return self._s[2301]! } + public var ChannelInfo_DeleteGroup: String { return self._s[2302]! } + public var Settings_BlockedUsers: String { return self._s[2303]! } public func Time_MonthOfYear_m4(_ _0: String) -> (String, [(Int, NSRange)]) { - return formatWithArgumentRanges(self._s[2302]!, self._r[2302]!, [_0]) + return formatWithArgumentRanges(self._s[2304]!, self._r[2304]!, [_0]) } - public var Passport_Address_AddResidentialAddress: String { return self._s[2303]! } - public var Channel_Username_Title: String { return self._s[2304]! } + public var Passport_Address_AddResidentialAddress: String { return self._s[2305]! } + public var Channel_Username_Title: String { return self._s[2306]! } public func Notification_RemovedGroupPhoto(_ _0: String) -> (String, [(Int, NSRange)]) { - return formatWithArgumentRanges(self._s[2305]!, self._r[2305]!, [_0]) + return formatWithArgumentRanges(self._s[2307]!, self._r[2307]!, [_0]) } - public var AttachmentMenu_File: String { return self._s[2307]! } - public var AppleWatch_Title: String { return self._s[2308]! } - public var Activity_RecordingVideoMessage: String { return self._s[2309]! } - public var Weekday_Saturday: String { return self._s[2310]! } - public var Profile_CreateEncryptedChatError: String { return self._s[2311]! } - public var Common_Next: String { return self._s[2313]! } - public var Channel_Stickers_YourStickers: String { return self._s[2315]! } - public var Call_AudioRouteHeadphones: String { return self._s[2316]! } - public var TwoStepAuth_EnterPasswordForgot: String { return self._s[2318]! } - public var Watch_Contacts_NoResults: String { return self._s[2320]! } - public var PhotoEditor_TintTool: String { return self._s[2322]! } - public var LoginPassword_ResetAccount: String { return self._s[2324]! } - public var Settings_SavedMessages: String { return self._s[2325]! } - public var StickerPack_Add: String { return self._s[2326]! } - public var Your_cards_number_is_invalid: String { return self._s[2327]! } - public var Checkout_TotalAmount: String { return self._s[2328]! } + public var AttachmentMenu_File: String { return self._s[2309]! } + public var AppleWatch_Title: String { return self._s[2310]! } + public var Activity_RecordingVideoMessage: String { return self._s[2311]! } + public var Weekday_Saturday: String { return self._s[2312]! } + public var Profile_CreateEncryptedChatError: String { return self._s[2313]! } + public var Common_Next: String { return self._s[2315]! } + public var Channel_Stickers_YourStickers: String { return self._s[2317]! } + public var Call_AudioRouteHeadphones: String { return self._s[2318]! } + public var TwoStepAuth_EnterPasswordForgot: String { return self._s[2320]! } + public var Watch_Contacts_NoResults: String { return self._s[2322]! } + public var PhotoEditor_TintTool: String { return self._s[2324]! } + public var LoginPassword_ResetAccount: String { return self._s[2326]! } + public var Settings_SavedMessages: String { return self._s[2327]! } + public var StickerPack_Add: String { return self._s[2328]! } + public var Your_cards_number_is_invalid: String { return self._s[2329]! } + public var Checkout_TotalAmount: String { return self._s[2330]! } public func ChangePhoneNumberCode_CallTimer(_ _0: String) -> (String, [(Int, NSRange)]) { - return formatWithArgumentRanges(self._s[2329]!, self._r[2329]!, [_0]) + return formatWithArgumentRanges(self._s[2331]!, self._r[2331]!, [_0]) } - public var ChatSettings_ConnectionType_UseSocks5: String { return self._s[2330]! } + public var ChatSettings_ConnectionType_UseSocks5: String { return self._s[2332]! } public func CHANNEL_MESSAGE_STICKER(_ _1: String, _ _2: String) -> (String, [(Int, NSRange)]) { - return formatWithArgumentRanges(self._s[2332]!, self._r[2332]!, [_1, _2]) + return formatWithArgumentRanges(self._s[2334]!, self._r[2334]!, [_1, _2]) } public func Conversation_RestrictedTextTimed(_ _0: String) -> (String, [(Int, NSRange)]) { - return formatWithArgumentRanges(self._s[2333]!, self._r[2333]!, [_0]) + return formatWithArgumentRanges(self._s[2335]!, self._r[2335]!, [_0]) } - public var GroupInfo_InviteLink_ShareLink: String { return self._s[2334]! } - public var StickerPack_Share: String { return self._s[2335]! } - public var Passport_DeleteAddress: String { return self._s[2336]! } - public var Settings_Passport: String { return self._s[2337]! } - public var SharedMedia_EmptyFilesText: String { return self._s[2338]! } - public var Conversation_DeleteMessagesForMe: String { return self._s[2339]! } - public var PasscodeSettings_AutoLock_IfAwayFor_1hour: String { return self._s[2340]! } - public var Contacts_PermissionsText: String { return self._s[2341]! } - public var Group_Setup_HistoryVisible: String { return self._s[2342]! } - public var Permissions_SiriAllow: String { return self._s[2344]! } - public var Passport_Address_AddRentalAgreement: String { return self._s[2345]! } - public var SocksProxySetup_Title: String { return self._s[2346]! } - public var Notification_Mute1h: String { return self._s[2347]! } + public var GroupInfo_InviteLink_ShareLink: String { return self._s[2336]! } + public var StickerPack_Share: String { return self._s[2337]! } + public var Passport_DeleteAddress: String { return self._s[2338]! } + public var Settings_Passport: String { return self._s[2339]! } + public var SharedMedia_EmptyFilesText: String { return self._s[2340]! } + public var Conversation_DeleteMessagesForMe: String { return self._s[2341]! } + public var PasscodeSettings_AutoLock_IfAwayFor_1hour: String { return self._s[2342]! } + public var Contacts_PermissionsText: String { return self._s[2343]! } + public var Group_Setup_HistoryVisible: String { return self._s[2344]! } + public var Passport_Address_AddRentalAgreement: String { return self._s[2346]! } + public var SocksProxySetup_Title: String { return self._s[2347]! } + public var Notification_Mute1h: String { return self._s[2348]! } public func Passport_Email_CodeHelp(_ _0: String) -> (String, [(Int, NSRange)]) { - return formatWithArgumentRanges(self._s[2348]!, self._r[2348]!, [_0]) + return formatWithArgumentRanges(self._s[2349]!, self._r[2349]!, [_0]) } - public var FastTwoStepSetup_PasswordSection: String { return self._s[2349]! } - public var NetworkUsageSettings_ResetStatsConfirmation: String { return self._s[2352]! } - public var InfoPlist_NSFaceIDUsageDescription: String { return self._s[2354]! } - public var DialogList_NoMessagesText: String { return self._s[2355]! } - public var Privacy_ContactsResetConfirmation: String { return self._s[2356]! } - public var Privacy_Calls_P2PHelp: String { return self._s[2357]! } - public var Your_cards_expiration_year_is_invalid: String { return self._s[2359]! } - public var Common_TakePhotoOrVideo: String { return self._s[2360]! } - public var Call_StatusBusy: String { return self._s[2361]! } - public var Conversation_PinnedMessage: String { return self._s[2362]! } - public var AutoDownloadSettings_VoiceMessagesTitle: String { return self._s[2363]! } - public var TwoStepAuth_SetupPasswordConfirmFailed: String { return self._s[2364]! } - public var AppleWatch_ReplyPresets: String { return self._s[2365]! } - public var Passport_DiscardMessageDescription: String { return self._s[2367]! } - public var Login_NetworkError: String { return self._s[2368]! } + public var FastTwoStepSetup_PasswordSection: String { return self._s[2350]! } + public var NetworkUsageSettings_ResetStatsConfirmation: String { return self._s[2353]! } + public var InfoPlist_NSFaceIDUsageDescription: String { return self._s[2355]! } + public var DialogList_NoMessagesText: String { return self._s[2356]! } + public var Privacy_ContactsResetConfirmation: String { return self._s[2357]! } + public var Privacy_Calls_P2PHelp: String { return self._s[2358]! } + public var Your_cards_expiration_year_is_invalid: String { return self._s[2360]! } + public var Common_TakePhotoOrVideo: String { return self._s[2361]! } + public var Call_StatusBusy: String { return self._s[2362]! } + public var Conversation_PinnedMessage: String { return self._s[2363]! } + public var AutoDownloadSettings_VoiceMessagesTitle: String { return self._s[2364]! } + public var TwoStepAuth_SetupPasswordConfirmFailed: String { return self._s[2365]! } + public var AppleWatch_ReplyPresets: String { return self._s[2366]! } + public var Passport_DiscardMessageDescription: String { return self._s[2368]! } + public var Login_NetworkError: String { return self._s[2369]! } public func Notification_PinnedRoundMessage(_ _0: String) -> (String, [(Int, NSRange)]) { - return formatWithArgumentRanges(self._s[2369]!, self._r[2369]!, [_0]) - } - public func Channel_AdminLog_MessageRemovedChannelUsername(_ _0: String) -> (String, [(Int, NSRange)]) { return formatWithArgumentRanges(self._s[2370]!, self._r[2370]!, [_0]) } - public var SocksProxySetup_PasswordPlaceholder: String { return self._s[2371]! } + public func Channel_AdminLog_MessageRemovedChannelUsername(_ _0: String) -> (String, [(Int, NSRange)]) { + return formatWithArgumentRanges(self._s[2371]!, self._r[2371]!, [_0]) + } + public var SocksProxySetup_PasswordPlaceholder: String { return self._s[2372]! } public func CONTACT_JOINED(_ _1: String) -> (String, [(Int, NSRange)]) { - return formatWithArgumentRanges(self._s[2373]!, self._r[2373]!, [_1]) + return formatWithArgumentRanges(self._s[2374]!, self._r[2374]!, [_1]) } - public var Login_ResetAccountProtected_LimitExceeded: String { return self._s[2374]! } + public var Login_ResetAccountProtected_LimitExceeded: String { return self._s[2375]! } public func Watch_LastSeen_YesterdayAt(_ _0: String) -> (String, [(Int, NSRange)]) { - return formatWithArgumentRanges(self._s[2376]!, self._r[2376]!, [_0]) + return formatWithArgumentRanges(self._s[2377]!, self._r[2377]!, [_0]) } - public var Call_ConnectionErrorMessage: String { return self._s[2377]! } - public var Compose_GroupTokenListPlaceholder: String { return self._s[2379]! } - public var ConversationMedia_Title: String { return self._s[2380]! } - public var EncryptionKey_Title: String { return self._s[2382]! } - public var TwoStepAuth_EnterPasswordTitle: String { return self._s[2383]! } - public var Notification_Exceptions_AddException: String { return self._s[2384]! } - public var Profile_MessageLifetime1m: String { return self._s[2385]! } + public var Call_ConnectionErrorMessage: String { return self._s[2378]! } + public var Compose_GroupTokenListPlaceholder: String { return self._s[2380]! } + public var ConversationMedia_Title: String { return self._s[2381]! } + public var EncryptionKey_Title: String { return self._s[2383]! } + public var TwoStepAuth_EnterPasswordTitle: String { return self._s[2384]! } + public var Notification_Exceptions_AddException: String { return self._s[2385]! } + public var Profile_MessageLifetime1m: String { return self._s[2386]! } public func Channel_AdminLog_MessageUnkickedName(_ _1: String) -> (String, [(Int, NSRange)]) { - return formatWithArgumentRanges(self._s[2386]!, self._r[2386]!, [_1]) + return formatWithArgumentRanges(self._s[2387]!, self._r[2387]!, [_1]) } - public var Month_GenMay: String { return self._s[2387]! } + public var Month_GenMay: String { return self._s[2388]! } public func LiveLocationUpdated_TodayAt(_ _0: String) -> (String, [(Int, NSRange)]) { - return formatWithArgumentRanges(self._s[2388]!, self._r[2388]!, [_0]) + return formatWithArgumentRanges(self._s[2389]!, self._r[2389]!, [_0]) } - public var ChannelMembers_WhoCanAddMembersAllHelp: String { return self._s[2389]! } - public var Conversation_EmptyPlaceholder: String { return self._s[2391]! } - public var Passport_Address_AddPassportRegistration: String { return self._s[2392]! } - public var Notifications_ChannelNotificationsAlert: String { return self._s[2393]! } - public var Camera_TapAndHoldForVideo: String { return self._s[2394]! } - public var Channel_JoinChannel: String { return self._s[2396]! } - public var Appearance_Animations: String { return self._s[2399]! } + public var ChannelMembers_WhoCanAddMembersAllHelp: String { return self._s[2390]! } + public var Conversation_EmptyPlaceholder: String { return self._s[2392]! } + public var Passport_Address_AddPassportRegistration: String { return self._s[2393]! } + public var Notifications_ChannelNotificationsAlert: String { return self._s[2394]! } + public var Camera_TapAndHoldForVideo: String { return self._s[2395]! } + public var Channel_JoinChannel: String { return self._s[2397]! } + public var Appearance_Animations: String { return self._s[2400]! } public func Notification_MessageLifetimeChanged(_ _1: String, _ _2: String) -> (String, [(Int, NSRange)]) { - return formatWithArgumentRanges(self._s[2400]!, self._r[2400]!, [_1, _2]) + return formatWithArgumentRanges(self._s[2401]!, self._r[2401]!, [_1, _2]) } - public var Stickers_GroupStickers: String { return self._s[2402]! } - public var ConvertToSupergroup_HelpTitle: String { return self._s[2404]! } - public var Passport_Address_Street: String { return self._s[2405]! } - public var Conversation_AddContact: String { return self._s[2406]! } - public var Login_PhonePlaceholder: String { return self._s[2407]! } - public var Channel_Members_InviteLink: String { return self._s[2409]! } - public var Bot_Stop: String { return self._s[2410]! } - public var Notification_PassportValueAddress: String { return self._s[2412]! } - public var Month_ShortJuly: String { return self._s[2413]! } - public var Passport_Address_TypeTemporaryRegistrationUploadScan: String { return self._s[2414]! } - public var Channel_AdminLog_BanSendMedia: String { return self._s[2415]! } - public var Passport_Identity_ReverseSide: String { return self._s[2416]! } - public var Watch_Stickers_Recents: String { return self._s[2419]! } - public var PrivacyLastSeenSettings_EmpryUsersPlaceholder: String { return self._s[2421]! } - public var Map_SendThisLocation: String { return self._s[2422]! } + public var Stickers_GroupStickers: String { return self._s[2403]! } + public var ConvertToSupergroup_HelpTitle: String { return self._s[2405]! } + public var Passport_Address_Street: String { return self._s[2406]! } + public var Conversation_AddContact: String { return self._s[2407]! } + public var Login_PhonePlaceholder: String { return self._s[2408]! } + public var Channel_Members_InviteLink: String { return self._s[2410]! } + public var Bot_Stop: String { return self._s[2411]! } + public var Notification_PassportValueAddress: String { return self._s[2413]! } + public var Month_ShortJuly: String { return self._s[2414]! } + public var Passport_Address_TypeTemporaryRegistrationUploadScan: String { return self._s[2415]! } + public var Channel_AdminLog_BanSendMedia: String { return self._s[2416]! } + public var Passport_Identity_ReverseSide: String { return self._s[2417]! } + public var Watch_Stickers_Recents: String { return self._s[2420]! } + public var PrivacyLastSeenSettings_EmpryUsersPlaceholder: String { return self._s[2422]! } + public var Map_SendThisLocation: String { return self._s[2423]! } public func Time_MonthOfYear_m1(_ _0: String) -> (String, [(Int, NSRange)]) { - return formatWithArgumentRanges(self._s[2423]!, self._r[2423]!, [_0]) - } - public func InviteText_SingleContact(_ _0: String) -> (String, [(Int, NSRange)]) { return formatWithArgumentRanges(self._s[2424]!, self._r[2424]!, [_0]) } - public var ConvertToSupergroup_Note: String { return self._s[2425]! } + public func InviteText_SingleContact(_ _0: String) -> (String, [(Int, NSRange)]) { + return formatWithArgumentRanges(self._s[2425]!, self._r[2425]!, [_0]) + } + public var ConvertToSupergroup_Note: String { return self._s[2426]! } public func FileSize_MB(_ _0: String) -> (String, [(Int, NSRange)]) { - return formatWithArgumentRanges(self._s[2426]!, self._r[2426]!, [_0]) + return formatWithArgumentRanges(self._s[2427]!, self._r[2427]!, [_0]) } - public var NetworkUsageSettings_GeneralDataSection: String { return self._s[2427]! } + public var NetworkUsageSettings_GeneralDataSection: String { return self._s[2428]! } public func Compatibility_SecretMediaVersionTooLow(_ _0: String, _ _1: String) -> (String, [(Int, NSRange)]) { - return formatWithArgumentRanges(self._s[2428]!, self._r[2428]!, [_0, _1]) + return formatWithArgumentRanges(self._s[2429]!, self._r[2429]!, [_0, _1]) } - public var Login_CallRequestState3: String { return self._s[2430]! } + public var Login_CallRequestState3: String { return self._s[2431]! } public func CHANNEL_MESSAGE_GEO(_ _1: String) -> (String, [(Int, NSRange)]) { - return formatWithArgumentRanges(self._s[2432]!, self._r[2432]!, [_1]) + return formatWithArgumentRanges(self._s[2433]!, self._r[2433]!, [_1]) } - public var PasscodeSettings_UnlockWithFaceId: String { return self._s[2433]! } - public var Channel_AdminLogFilter_Title: String { return self._s[2434]! } - public var Notifications_GroupNotificationsExceptions: String { return self._s[2438]! } + public var PasscodeSettings_UnlockWithFaceId: String { return self._s[2434]! } + public var Channel_AdminLogFilter_Title: String { return self._s[2435]! } + public var Notifications_GroupNotificationsExceptions: String { return self._s[2439]! } public func FileSize_B(_ _0: String) -> (String, [(Int, NSRange)]) { - return formatWithArgumentRanges(self._s[2439]!, self._r[2439]!, [_0]) + return formatWithArgumentRanges(self._s[2440]!, self._r[2440]!, [_0]) } - public var Passport_CorrectErrors: String { return self._s[2440]! } + public var Passport_CorrectErrors: String { return self._s[2441]! } public func Channel_MessageTitleUpdated(_ _0: String) -> (String, [(Int, NSRange)]) { - return formatWithArgumentRanges(self._s[2441]!, self._r[2441]!, [_0]) + return formatWithArgumentRanges(self._s[2442]!, self._r[2442]!, [_0]) } - public var Map_SendMyCurrentLocation: String { return self._s[2442]! } - public var LoginPassword_FloodError: String { return self._s[2443]! } - public var Group_Setup_HistoryHiddenHelp: String { return self._s[2445]! } + public var Map_SendMyCurrentLocation: String { return self._s[2443]! } + public var Permissions_NotificationsText_v0: String { return self._s[2444]! } + public var LoginPassword_FloodError: String { return self._s[2445]! } + public var Group_Setup_HistoryHiddenHelp: String { return self._s[2447]! } public func TwoStepAuth_PendingEmailHelp(_ _0: String) -> (String, [(Int, NSRange)]) { - return formatWithArgumentRanges(self._s[2446]!, self._r[2446]!, [_0]) - } - public var Passport_Language_bn: String { return self._s[2447]! } - public func DialogList_SingleUploadingPhotoSuffix(_ _0: String) -> (String, [(Int, NSRange)]) { return formatWithArgumentRanges(self._s[2448]!, self._r[2448]!, [_0]) } - public func Notification_PinnedAudioMessage(_ _0: String) -> (String, [(Int, NSRange)]) { - return formatWithArgumentRanges(self._s[2449]!, self._r[2449]!, [_0]) - } - public func Channel_AdminLog_MessageChangedGroupStickerPack(_ _0: String) -> (String, [(Int, NSRange)]) { + public var Passport_Language_bn: String { return self._s[2449]! } + public func DialogList_SingleUploadingPhotoSuffix(_ _0: String) -> (String, [(Int, NSRange)]) { return formatWithArgumentRanges(self._s[2450]!, self._r[2450]!, [_0]) } - public var GroupInfo_InvitationLinkGroupFull: String { return self._s[2453]! } - public var Group_EditAdmin_PermissionChangeInfo: String { return self._s[2455]! } - public var Contacts_PermissionsAllow: String { return self._s[2456]! } - public var ReportPeer_ReasonCopyright: String { return self._s[2457]! } - public var Channel_EditAdmin_PermissinAddAdminOn: String { return self._s[2458]! } - public var Paint_Duplicate: String { return self._s[2459]! } - public var Notification_ChannelMigratedFrom: String { return self._s[2460]! } - public var Passport_Address_Country: String { return self._s[2461]! } - public var Notification_RenamedChannel: String { return self._s[2462]! } - public var CheckoutInfo_ErrorPostcodeInvalid: String { return self._s[2463]! } - public var Group_MessagePhotoUpdated: String { return self._s[2464]! } - public var Channel_BanUser_PermissionSendMedia: String { return self._s[2465]! } - public var Conversation_ContextMenuBan: String { return self._s[2466]! } - public var TwoStepAuth_EmailSent: String { return self._s[2467]! } - public var Passport_Language_is: String { return self._s[2468]! } - public var Tour_Text5: String { return self._s[2470]! } + public func Notification_PinnedAudioMessage(_ _0: String) -> (String, [(Int, NSRange)]) { + return formatWithArgumentRanges(self._s[2451]!, self._r[2451]!, [_0]) + } + public func Channel_AdminLog_MessageChangedGroupStickerPack(_ _0: String) -> (String, [(Int, NSRange)]) { + return formatWithArgumentRanges(self._s[2452]!, self._r[2452]!, [_0]) + } + public var GroupInfo_InvitationLinkGroupFull: String { return self._s[2455]! } + public var Group_EditAdmin_PermissionChangeInfo: String { return self._s[2457]! } + public var Contacts_PermissionsAllow: String { return self._s[2458]! } + public var ReportPeer_ReasonCopyright: String { return self._s[2459]! } + public var Channel_EditAdmin_PermissinAddAdminOn: String { return self._s[2460]! } + public var Paint_Duplicate: String { return self._s[2461]! } + public var Notification_ChannelMigratedFrom: String { return self._s[2462]! } + public var Passport_Address_Country: String { return self._s[2463]! } + public var Notification_RenamedChannel: String { return self._s[2464]! } + public var CheckoutInfo_ErrorPostcodeInvalid: String { return self._s[2465]! } + public var Group_MessagePhotoUpdated: String { return self._s[2466]! } + public var Channel_BanUser_PermissionSendMedia: String { return self._s[2467]! } + public var Conversation_ContextMenuBan: String { return self._s[2468]! } + public var TwoStepAuth_EmailSent: String { return self._s[2469]! } + public var Passport_Language_is: String { return self._s[2470]! } + public var Tour_Text5: String { return self._s[2472]! } public func Call_GroupFormat(_ _1: String, _ _2: String) -> (String, [(Int, NSRange)]) { - return formatWithArgumentRanges(self._s[2472]!, self._r[2472]!, [_1, _2]) + return formatWithArgumentRanges(self._s[2474]!, self._r[2474]!, [_1, _2]) } - public var Paint_Edit: String { return self._s[2474]! } - public var LoginPassword_ForgotPassword: String { return self._s[2477]! } - public var GroupInfo_GroupNamePlaceholder: String { return self._s[2478]! } + public var Paint_Edit: String { return self._s[2476]! } + public var LoginPassword_ForgotPassword: String { return self._s[2479]! } + public var GroupInfo_GroupNamePlaceholder: String { return self._s[2480]! } public func Notification_Kicked(_ _0: String, _ _1: String) -> (String, [(Int, NSRange)]) { - return formatWithArgumentRanges(self._s[2479]!, self._r[2479]!, [_0, _1]) + return formatWithArgumentRanges(self._s[2481]!, self._r[2481]!, [_0, _1]) } - public var Conversation_InputTextCaptionPlaceholder: String { return self._s[2480]! } - public var AutoDownloadSettings_VideoMessagesTitle: String { return self._s[2481]! } - public var Passport_Language_uz: String { return self._s[2482]! } - public var Conversation_PinMessageAlertGroup: String { return self._s[2483]! } - public var Map_StopLiveLocation: String { return self._s[2485]! } - public var PasscodeSettings_Help: String { return self._s[2487]! } - public var NotificationsSound_Input: String { return self._s[2488]! } - public var Share_Title: String { return self._s[2490]! } - public var Login_TermsOfServiceAgree: String { return self._s[2491]! } - public var Channel_AdminLog_TitleSelectedEvents: String { return self._s[2492]! } - public var EnterPasscode_EnterTitle: String { return self._s[2493]! } - public var Channel_EditAdmin_PermissionEditMessages: String { return self._s[2494]! } + public var Conversation_InputTextCaptionPlaceholder: String { return self._s[2482]! } + public var AutoDownloadSettings_VideoMessagesTitle: String { return self._s[2483]! } + public var Passport_Language_uz: String { return self._s[2484]! } + public var Conversation_PinMessageAlertGroup: String { return self._s[2485]! } + public var Map_StopLiveLocation: String { return self._s[2487]! } + public var PasscodeSettings_Help: String { return self._s[2489]! } + public var NotificationsSound_Input: String { return self._s[2490]! } + public var Share_Title: String { return self._s[2492]! } + public var Login_TermsOfServiceAgree: String { return self._s[2493]! } + public var Channel_AdminLog_TitleSelectedEvents: String { return self._s[2494]! } + public var EnterPasscode_EnterTitle: String { return self._s[2495]! } + public var Channel_EditAdmin_PermissionEditMessages: String { return self._s[2496]! } public func Call_PrivacyErrorMessage(_ _0: String) -> (String, [(Int, NSRange)]) { - return formatWithArgumentRanges(self._s[2495]!, self._r[2495]!, [_0]) + return formatWithArgumentRanges(self._s[2497]!, self._r[2497]!, [_0]) } - public var Settings_CopyPhoneNumber: String { return self._s[2496]! } - public var NotificationsSound_Keys: String { return self._s[2497]! } + public var Settings_CopyPhoneNumber: String { return self._s[2498]! } + public var NotificationsSound_Keys: String { return self._s[2499]! } public func Call_ParticipantVersionOutdatedError(_ _0: String) -> (String, [(Int, NSRange)]) { - return formatWithArgumentRanges(self._s[2498]!, self._r[2498]!, [_0]) + return formatWithArgumentRanges(self._s[2500]!, self._r[2500]!, [_0]) } - public var Notification_MessageLifetime1w: String { return self._s[2499]! } - public var Message_Video: String { return self._s[2500]! } + public var Notification_MessageLifetime1w: String { return self._s[2501]! } + public var Message_Video: String { return self._s[2502]! } public func Notification_JoinedChat(_ _0: String) -> (String, [(Int, NSRange)]) { - return formatWithArgumentRanges(self._s[2503]!, self._r[2503]!, [_0]) + return formatWithArgumentRanges(self._s[2505]!, self._r[2505]!, [_0]) } public func PrivacySettings_LastSeenContactsPlus(_ _0: String) -> (String, [(Int, NSRange)]) { - return formatWithArgumentRanges(self._s[2504]!, self._r[2504]!, [_0]) + return formatWithArgumentRanges(self._s[2506]!, self._r[2506]!, [_0]) } - public var Passport_Language_mk: String { return self._s[2505]! } - public var Conversation_SilentBroadcastTooltipOn: String { return self._s[2507]! } - public var PrivacyPolicy_Decline: String { return self._s[2508]! } - public var Passport_Identity_DoesNotExpire: String { return self._s[2509]! } - public var Channel_AdminLogFilter_EventsRestrictions: String { return self._s[2510]! } + public var Passport_Language_mk: String { return self._s[2507]! } + public var Conversation_SilentBroadcastTooltipOn: String { return self._s[2509]! } + public var PrivacyPolicy_Decline: String { return self._s[2510]! } + public var Passport_Identity_DoesNotExpire: String { return self._s[2511]! } + public var Channel_AdminLogFilter_EventsRestrictions: String { return self._s[2512]! } + public var Permissions_SiriAllow_v0: String { return self._s[2513]! } public func CHAT_MESSAGE_STICKER(_ _1: String, _ _2: String, _ _3: String) -> (String, [(Int, NSRange)]) { - return formatWithArgumentRanges(self._s[2511]!, self._r[2511]!, [_1, _2, _3]) + return formatWithArgumentRanges(self._s[2514]!, self._r[2514]!, [_1, _2, _3]) } public func CHANNEL_MESSAGES(_ _1: String, _ _2: String) -> (String, [(Int, NSRange)]) { - return formatWithArgumentRanges(self._s[2512]!, self._r[2512]!, [_1, _2]) + return formatWithArgumentRanges(self._s[2515]!, self._r[2515]!, [_1, _2]) } public func Notification_RenamedChat(_ _0: String) -> (String, [(Int, NSRange)]) { - return formatWithArgumentRanges(self._s[2513]!, self._r[2513]!, [_0]) + return formatWithArgumentRanges(self._s[2516]!, self._r[2516]!, [_0]) } - public var Paint_Regular: String { return self._s[2514]! } - public var ChatSettings_AutoDownloadReset: String { return self._s[2515]! } - public var BlockedUsers_SelectUserTitle: String { return self._s[2516]! } - public var GroupInfo_InviteByLink: String { return self._s[2518]! } - public var MessageTimer_Custom: String { return self._s[2519]! } - public var UserInfo_NotificationsDefaultEnabled: String { return self._s[2520]! } - public var Passport_Address_TypeTemporaryRegistration: String { return self._s[2522]! } - public var Channel_Username_InvalidTaken: String { return self._s[2523]! } - public var Conversation_ClousStorageInfo_Description3: String { return self._s[2524]! } + public var Paint_Regular: String { return self._s[2517]! } + public var ChatSettings_AutoDownloadReset: String { return self._s[2518]! } + public var BlockedUsers_SelectUserTitle: String { return self._s[2519]! } + public var GroupInfo_InviteByLink: String { return self._s[2521]! } + public var MessageTimer_Custom: String { return self._s[2522]! } + public var UserInfo_NotificationsDefaultEnabled: String { return self._s[2523]! } + public var Passport_Address_TypeTemporaryRegistration: String { return self._s[2525]! } + public var Channel_Username_InvalidTaken: String { return self._s[2526]! } + public var Conversation_ClousStorageInfo_Description3: String { return self._s[2527]! } public func CHANNEL_MESSAGE_VIDEO(_ _1: String) -> (String, [(Int, NSRange)]) { - return formatWithArgumentRanges(self._s[2525]!, self._r[2525]!, [_1]) + return formatWithArgumentRanges(self._s[2528]!, self._r[2528]!, [_1]) } - public var Settings_ChatBackground: String { return self._s[2526]! } - public var Channel_Subscribers_Title: String { return self._s[2527]! } - public var ApplyLanguage_ChangeLanguageTitle: String { return self._s[2528]! } - public var Watch_ConnectionDescription: String { return self._s[2529]! } - public var EditProfile_Title: String { return self._s[2533]! } - public var NotificationsSound_Bamboo: String { return self._s[2535]! } - public var Channel_AdminLog_MessagePreviousMessage: String { return self._s[2536]! } - public var Login_SmsRequestState2: String { return self._s[2537]! } - public var Passport_Language_ar: String { return self._s[2538]! } - public var Conversation_MessageDialogEdit: String { return self._s[2539]! } - public var Common_Close: String { return self._s[2540]! } + public var Settings_ChatBackground: String { return self._s[2529]! } + public var Channel_Subscribers_Title: String { return self._s[2530]! } + public var ApplyLanguage_ChangeLanguageTitle: String { return self._s[2531]! } + public var Watch_ConnectionDescription: String { return self._s[2532]! } + public var EditProfile_Title: String { return self._s[2536]! } + public var NotificationsSound_Bamboo: String { return self._s[2538]! } + public var Channel_AdminLog_MessagePreviousMessage: String { return self._s[2539]! } + public var Login_SmsRequestState2: String { return self._s[2540]! } + public var Passport_Language_ar: String { return self._s[2541]! } + public var Conversation_MessageDialogEdit: String { return self._s[2542]! } + public var Common_Close: String { return self._s[2543]! } public func Channel_AdminLog_MessageToggleInvitesOff(_ _0: String) -> (String, [(Int, NSRange)]) { - return formatWithArgumentRanges(self._s[2544]!, self._r[2544]!, [_0]) + return formatWithArgumentRanges(self._s[2547]!, self._r[2547]!, [_0]) } - public var UserInfo_About_Placeholder: String { return self._s[2545]! } + public var UserInfo_About_Placeholder: String { return self._s[2548]! } public func Conversation_FileHowToText(_ _0: String) -> (String, [(Int, NSRange)]) { - return formatWithArgumentRanges(self._s[2546]!, self._r[2546]!, [_0]) - } - public var Channel_Info_Banned: String { return self._s[2548]! } - public func Time_MonthOfYear_m11(_ _0: String) -> (String, [(Int, NSRange)]) { return formatWithArgumentRanges(self._s[2549]!, self._r[2549]!, [_0]) } - public var Passport_Language_my: String { return self._s[2550]! } + public var Channel_Info_Banned: String { return self._s[2551]! } + public func Time_MonthOfYear_m11(_ _0: String) -> (String, [(Int, NSRange)]) { + return formatWithArgumentRanges(self._s[2552]!, self._r[2552]!, [_0]) + } + public var Passport_Language_my: String { return self._s[2553]! } public func Time_PreciseDate_m9(_ _1: String, _ _2: String, _ _3: String) -> (String, [(Int, NSRange)]) { - return formatWithArgumentRanges(self._s[2551]!, self._r[2551]!, [_1, _2, _3]) + return formatWithArgumentRanges(self._s[2554]!, self._r[2554]!, [_1, _2, _3]) } - public var Preview_CopyAddress: String { return self._s[2552]! } + public var Preview_CopyAddress: String { return self._s[2555]! } public func DialogList_SinglePlayingGameSuffix(_ _0: String) -> (String, [(Int, NSRange)]) { - return formatWithArgumentRanges(self._s[2553]!, self._r[2553]!, [_0]) + return formatWithArgumentRanges(self._s[2556]!, self._r[2556]!, [_0]) } - public var KeyCommand_JumpToPreviousChat: String { return self._s[2554]! } - public var UserInfo_BotSettings: String { return self._s[2555]! } - public var Username_TooManyPublicUsernamesError: String { return self._s[2557]! } - public var Passport_PasswordCreate: String { return self._s[2558]! } - public var Permissions_ContactsAllowInSettings: String { return self._s[2559]! } - public var Message_PinnedLocationMessage: String { return self._s[2560]! } - public var Map_Satellite: String { return self._s[2561]! } + public var KeyCommand_JumpToPreviousChat: String { return self._s[2557]! } + public var UserInfo_BotSettings: String { return self._s[2558]! } + public var Username_TooManyPublicUsernamesError: String { return self._s[2560]! } + public var Passport_PasswordCreate: String { return self._s[2561]! } public var LiveLocation_MenuStopAll: String { return self._s[2562]! } - public var StickerSettings_MaskContextInfo: String { return self._s[2563]! } - public var TwoStepAuth_EnterPasswordInvalid: String { return self._s[2564]! } + public var Message_PinnedLocationMessage: String { return self._s[2563]! } + public var Map_Satellite: String { return self._s[2564]! } + public var StickerSettings_MaskContextInfo: String { return self._s[2565]! } + public var TwoStepAuth_EnterPasswordInvalid: String { return self._s[2566]! } public func Notification_PinnedTextMessage(_ _0: String, _ _1: String) -> (String, [(Int, NSRange)]) { - return formatWithArgumentRanges(self._s[2565]!, self._r[2565]!, [_0, _1]) + return formatWithArgumentRanges(self._s[2567]!, self._r[2567]!, [_0, _1]) } - public var Notifications_ChannelNotificationsHelp: String { return self._s[2566]! } - public var Privacy_Calls_P2PContacts: String { return self._s[2567]! } - public var NotificationsSound_None: String { return self._s[2568]! } - public var AccessDenied_VoiceMicrophone: String { return self._s[2570]! } + public var Notifications_ChannelNotificationsHelp: String { return self._s[2568]! } + public var Privacy_Calls_P2PContacts: String { return self._s[2569]! } + public var NotificationsSound_None: String { return self._s[2570]! } + public var AccessDenied_VoiceMicrophone: String { return self._s[2572]! } public func ApplyLanguage_ChangeLanguageAlreadyActive(_ _1: String) -> (String, [(Int, NSRange)]) { - return formatWithArgumentRanges(self._s[2571]!, self._r[2571]!, [_1]) + return formatWithArgumentRanges(self._s[2573]!, self._r[2573]!, [_1]) } - public var Cache_Indexing: String { return self._s[2572]! } - public var DialogList_RecentTitlePeople: String { return self._s[2574]! } - public var DialogList_EncryptionRejected: String { return self._s[2575]! } - public var Passport_ScanPassportHelp: String { return self._s[2576]! } - public var Application_Name: String { return self._s[2577]! } - public var Channel_AdminLogFilter_ChannelEventsInfo: String { return self._s[2578]! } - public var Passport_Identity_TranslationHelp: String { return self._s[2580]! } + public var Cache_Indexing: String { return self._s[2574]! } + public var DialogList_RecentTitlePeople: String { return self._s[2576]! } + public var DialogList_EncryptionRejected: String { return self._s[2577]! } + public var Passport_ScanPassportHelp: String { return self._s[2578]! } + public var Application_Name: String { return self._s[2579]! } + public var Channel_AdminLogFilter_ChannelEventsInfo: String { return self._s[2580]! } + public var Passport_Identity_TranslationHelp: String { return self._s[2582]! } public func Notification_JoinedGroupByLink(_ _0: String) -> (String, [(Int, NSRange)]) { - return formatWithArgumentRanges(self._s[2581]!, self._r[2581]!, [_0]) + return formatWithArgumentRanges(self._s[2583]!, self._r[2583]!, [_0]) } public func DialogList_EncryptedChatStartedOutgoing(_ _0: String) -> (String, [(Int, NSRange)]) { - return formatWithArgumentRanges(self._s[2582]!, self._r[2582]!, [_0]) + return formatWithArgumentRanges(self._s[2584]!, self._r[2584]!, [_0]) } - public var Channel_EditAdmin_PermissionDeleteMessages: String { return self._s[2583]! } - public var Privacy_ChatsTitle: String { return self._s[2584]! } - public var DialogList_ClearHistoryConfirmation: String { return self._s[2585]! } - public var Watch_Suggestion_HoldOn: String { return self._s[2586]! } - public var SocksProxySetup_RequiredCredentials: String { return self._s[2587]! } - public var Passport_Address_TypeRentalAgreementUploadScan: String { return self._s[2588]! } - public var TwoStepAuth_EmailSkipAlert: String { return self._s[2589]! } - public var Channel_Setup_TypePublic: String { return self._s[2592]! } + public var Channel_EditAdmin_PermissionDeleteMessages: String { return self._s[2585]! } + public var Privacy_ChatsTitle: String { return self._s[2586]! } + public var DialogList_ClearHistoryConfirmation: String { return self._s[2587]! } + public var Watch_Suggestion_HoldOn: String { return self._s[2588]! } + public var SocksProxySetup_RequiredCredentials: String { return self._s[2589]! } + public var Passport_Address_TypeRentalAgreementUploadScan: String { return self._s[2590]! } + public var TwoStepAuth_EmailSkipAlert: String { return self._s[2591]! } + public var Channel_Setup_TypePublic: String { return self._s[2594]! } public func Channel_AdminLog_MessageToggleInvitesOn(_ _0: String) -> (String, [(Int, NSRange)]) { - return formatWithArgumentRanges(self._s[2593]!, self._r[2593]!, [_0]) + return formatWithArgumentRanges(self._s[2595]!, self._r[2595]!, [_0]) } - public var Channel_TypeSetup_Title: String { return self._s[2595]! } - public var Map_OpenInMaps: String { return self._s[2597]! } - public var NotificationsSound_Tremolo: String { return self._s[2599]! } + public var Channel_TypeSetup_Title: String { return self._s[2597]! } + public var Map_OpenInMaps: String { return self._s[2599]! } + public var NotificationsSound_Tremolo: String { return self._s[2601]! } public func Date_ChatDateHeaderYear(_ _1: String, _ _2: String, _ _3: String) -> (String, [(Int, NSRange)]) { - return formatWithArgumentRanges(self._s[2600]!, self._r[2600]!, [_1, _2, _3]) + return formatWithArgumentRanges(self._s[2602]!, self._r[2602]!, [_1, _2, _3]) } - public var ConversationProfile_UnknownAddMemberError: String { return self._s[2601]! } - public var Passport_PasswordHelp: String { return self._s[2602]! } - public var Login_CodeExpiredError: String { return self._s[2603]! } - public var Channel_EditAdmin_PermissionChangeInfo: String { return self._s[2604]! } - public var Passport_Identity_ScansHelp: String { return self._s[2605]! } - public var Passport_Language_lo: String { return self._s[2606]! } - public var Camera_FlashAuto: String { return self._s[2607]! } - public var Common_Cancel: String { return self._s[2608]! } - public var DialogList_SavedMessagesTooltip: String { return self._s[2609]! } - public var TwoStepAuth_SetupPasswordTitle: String { return self._s[2610]! } - public var Conversation_ReportSpamConfirmation: String { return self._s[2611]! } - public var ChatSettings_Title: String { return self._s[2613]! } - public var Passport_PasswordReset: String { return self._s[2614]! } - public var SocksProxySetup_TypeNone: String { return self._s[2615]! } - public var PhoneNumberHelp_Help: String { return self._s[2617]! } - public var Checkout_EnterPassword: String { return self._s[2618]! } - public var Share_AuthTitle: String { return self._s[2620]! } - public var Activity_UploadingDocument: String { return self._s[2621]! } - public var State_Connecting: String { return self._s[2622]! } - public var Profile_MessageLifetime1w: String { return self._s[2623]! } - public var Conversation_ContextMenuReport: String { return self._s[2624]! } - public var CheckoutInfo_ReceiverInfoPhone: String { return self._s[2625]! } - public var AutoNightTheme_ScheduledTo: String { return self._s[2626]! } - public var AuthSessions_Terminate: String { return self._s[2627]! } - public var Checkout_NewCard_CardholderNamePlaceholder: String { return self._s[2628]! } - public var KeyCommand_JumpToPreviousUnreadChat: String { return self._s[2629]! } - public var PhotoEditor_Set: String { return self._s[2630]! } - public var Login_PadPhoneHelp: String { return self._s[2631]! } - public var PrivacyPolicy_DeclineLastWarning: String { return self._s[2634]! } - public var NotificationsSound_Complete: String { return self._s[2635]! } - public var Group_Info_AdminLog: String { return self._s[2636]! } - public var Channel_AdminLog_InfoPanelAlertText: String { return self._s[2637]! } - public var Conversation_Admin: String { return self._s[2639]! } - public var Conversation_GifTooltip: String { return self._s[2640]! } - public var Passport_NotLoggedInMessage: String { return self._s[2641]! } - public var Profile_MessageLifetimeForever: String { return self._s[2642]! } - public var SharedMedia_EmptyTitle: String { return self._s[2644]! } - public var Channel_Edit_PrivatePublicLinkAlert: String { return self._s[2645]! } - public var Username_Help: String { return self._s[2646]! } - public var DialogList_LanguageTooltip: String { return self._s[2648]! } - public var Map_LoadError: String { return self._s[2649]! } - public var Notification_Exceptions_NewException: String { return self._s[2650]! } - public var TwoStepAuth_EmailTitle: String { return self._s[2651]! } - public var WatchRemote_AlertText: String { return self._s[2652]! } - public var ChatSettings_ConnectionType_Title: String { return self._s[2654]! } + public var ConversationProfile_UnknownAddMemberError: String { return self._s[2603]! } + public var Passport_PasswordHelp: String { return self._s[2604]! } + public var Login_CodeExpiredError: String { return self._s[2605]! } + public var Channel_EditAdmin_PermissionChangeInfo: String { return self._s[2606]! } + public var Passport_Identity_ScansHelp: String { return self._s[2607]! } + public var Passport_Language_lo: String { return self._s[2608]! } + public var Camera_FlashAuto: String { return self._s[2609]! } + public var Common_Cancel: String { return self._s[2610]! } + public var DialogList_SavedMessagesTooltip: String { return self._s[2611]! } + public var TwoStepAuth_SetupPasswordTitle: String { return self._s[2612]! } + public var Conversation_ReportSpamConfirmation: String { return self._s[2613]! } + public var ChatSettings_Title: String { return self._s[2615]! } + public var Passport_PasswordReset: String { return self._s[2616]! } + public var SocksProxySetup_TypeNone: String { return self._s[2617]! } + public var PhoneNumberHelp_Help: String { return self._s[2619]! } + public var Checkout_EnterPassword: String { return self._s[2620]! } + public var Share_AuthTitle: String { return self._s[2622]! } + public var Activity_UploadingDocument: String { return self._s[2623]! } + public var State_Connecting: String { return self._s[2624]! } + public var Profile_MessageLifetime1w: String { return self._s[2625]! } + public var Conversation_ContextMenuReport: String { return self._s[2626]! } + public var CheckoutInfo_ReceiverInfoPhone: String { return self._s[2627]! } + public var AutoNightTheme_ScheduledTo: String { return self._s[2628]! } + public var AuthSessions_Terminate: String { return self._s[2629]! } + public var Checkout_NewCard_CardholderNamePlaceholder: String { return self._s[2630]! } + public var KeyCommand_JumpToPreviousUnreadChat: String { return self._s[2631]! } + public var PhotoEditor_Set: String { return self._s[2632]! } + public var Login_PadPhoneHelp: String { return self._s[2633]! } + public var PrivacyPolicy_DeclineLastWarning: String { return self._s[2636]! } + public var NotificationsSound_Complete: String { return self._s[2637]! } + public var Group_Info_AdminLog: String { return self._s[2638]! } + public var Channel_AdminLog_InfoPanelAlertText: String { return self._s[2639]! } + public var Conversation_Admin: String { return self._s[2641]! } + public var Conversation_GifTooltip: String { return self._s[2642]! } + public var Passport_NotLoggedInMessage: String { return self._s[2643]! } + public var Profile_MessageLifetimeForever: String { return self._s[2644]! } + public var SharedMedia_EmptyTitle: String { return self._s[2646]! } + public var Channel_Edit_PrivatePublicLinkAlert: String { return self._s[2647]! } + public var Username_Help: String { return self._s[2648]! } + public var DialogList_LanguageTooltip: String { return self._s[2650]! } + public var Map_LoadError: String { return self._s[2651]! } + public var Notification_Exceptions_NewException: String { return self._s[2652]! } + public var TwoStepAuth_EmailTitle: String { return self._s[2653]! } + public var WatchRemote_AlertText: String { return self._s[2654]! } + public var ChatSettings_ConnectionType_Title: String { return self._s[2656]! } public func LOCKED_MESSAGE(_ _1: String) -> (String, [(Int, NSRange)]) { - return formatWithArgumentRanges(self._s[2655]!, self._r[2655]!, [_1]) + return formatWithArgumentRanges(self._s[2657]!, self._r[2657]!, [_1]) } - public var Passport_Address_CountryPlaceholder: String { return self._s[2656]! } + public var Passport_Address_CountryPlaceholder: String { return self._s[2658]! } public func DialogList_AwaitingEncryption(_ _0: String) -> (String, [(Int, NSRange)]) { - return formatWithArgumentRanges(self._s[2657]!, self._r[2657]!, [_0]) + return formatWithArgumentRanges(self._s[2659]!, self._r[2659]!, [_0]) } public func Time_PreciseDate_m6(_ _1: String, _ _2: String, _ _3: String) -> (String, [(Int, NSRange)]) { - return formatWithArgumentRanges(self._s[2658]!, self._r[2658]!, [_1, _2, _3]) + return formatWithArgumentRanges(self._s[2660]!, self._r[2660]!, [_1, _2, _3]) } - public var Group_AdminLog_EmptyText: String { return self._s[2659]! } - public var AccessDenied_VideoMicrophone: String { return self._s[2661]! } - public var Conversation_ContextMenuStickerPackAdd: String { return self._s[2662]! } - public var Cache_ClearNone: String { return self._s[2663]! } - public var SocksProxySetup_FailedToConnect: String { return self._s[2664]! } + public var Group_AdminLog_EmptyText: String { return self._s[2661]! } + public var AccessDenied_VideoMicrophone: String { return self._s[2663]! } + public var Conversation_ContextMenuStickerPackAdd: String { return self._s[2664]! } + public var Cache_ClearNone: String { return self._s[2665]! } + public var SocksProxySetup_FailedToConnect: String { return self._s[2666]! } + public var Permissions_NotificationsTitle_v0: String { return self._s[2667]! } public func Channel_AdminLog_MessageEdited(_ _0: String) -> (String, [(Int, NSRange)]) { - return formatWithArgumentRanges(self._s[2665]!, self._r[2665]!, [_0]) + return formatWithArgumentRanges(self._s[2668]!, self._r[2668]!, [_0]) } - public var Passport_Identity_Country: String { return self._s[2666]! } + public var Passport_Identity_Country: String { return self._s[2669]! } public func Notification_CreatedChat(_ _0: String) -> (String, [(Int, NSRange)]) { - return formatWithArgumentRanges(self._s[2667]!, self._r[2667]!, [_0]) + return formatWithArgumentRanges(self._s[2670]!, self._r[2670]!, [_0]) } - public var AccessDenied_Settings: String { return self._s[2668]! } - public var Passport_Address_TypeUtilityBillUploadScan: String { return self._s[2669]! } - public var Month_ShortMay: String { return self._s[2670]! } - public var Compose_NewGroup: String { return self._s[2671]! } - public var Group_Setup_TypePrivate: String { return self._s[2673]! } - public var Login_PadPhoneHelpTitle: String { return self._s[2674]! } - public var Appearance_ThemeDayClassic: String { return self._s[2675]! } - public var Channel_AdminLog_MessagePreviousCaption: String { return self._s[2676]! } - public var Privacy_GroupsAndChannels_WhoCanAddMe: String { return self._s[2677]! } - public var Conversation_typing: String { return self._s[2679]! } - public var Paint_Masks: String { return self._s[2680]! } - public var Username_InvalidTaken: String { return self._s[2681]! } - public var TwoStepAuth_EmailAddSuccess: String { return self._s[2682]! } + public var AccessDenied_Settings: String { return self._s[2671]! } + public var Passport_Address_TypeUtilityBillUploadScan: String { return self._s[2672]! } + public var Month_ShortMay: String { return self._s[2673]! } + public var Compose_NewGroup: String { return self._s[2674]! } + public var Group_Setup_TypePrivate: String { return self._s[2676]! } + public var Login_PadPhoneHelpTitle: String { return self._s[2677]! } + public var Appearance_ThemeDayClassic: String { return self._s[2678]! } + public var Channel_AdminLog_MessagePreviousCaption: String { return self._s[2679]! } + public var Privacy_GroupsAndChannels_WhoCanAddMe: String { return self._s[2680]! } + public var Conversation_typing: String { return self._s[2682]! } + public var Paint_Masks: String { return self._s[2683]! } + public var Username_InvalidTaken: String { return self._s[2684]! } + public var TwoStepAuth_EmailAddSuccess: String { return self._s[2685]! } public func CHAT_PHOTO_EDITED(_ _1: String, _ _2: String) -> (String, [(Int, NSRange)]) { - return formatWithArgumentRanges(self._s[2683]!, self._r[2683]!, [_1, _2]) + return formatWithArgumentRanges(self._s[2686]!, self._r[2686]!, [_1, _2]) } - public var Call_StatusNoAnswer: String { return self._s[2684]! } - public var Passport_Identity_Selfie: String { return self._s[2685]! } - public var Login_InfoLastNamePlaceholder: String { return self._s[2686]! } - public var Privacy_SecretChatsLinkPreviewsHelp: String { return self._s[2687]! } - public var Conversation_ClearSecretHistory: String { return self._s[2688]! } - public var NetworkUsageSettings_Title: String { return self._s[2690]! } - public var Your_cards_security_code_is_invalid: String { return self._s[2692]! } + public var Call_StatusNoAnswer: String { return self._s[2687]! } + public var Passport_Identity_Selfie: String { return self._s[2688]! } + public var Login_InfoLastNamePlaceholder: String { return self._s[2689]! } + public var Privacy_SecretChatsLinkPreviewsHelp: String { return self._s[2690]! } + public var Conversation_ClearSecretHistory: String { return self._s[2691]! } + public var NetworkUsageSettings_Title: String { return self._s[2693]! } + public var Your_cards_security_code_is_invalid: String { return self._s[2695]! } public func Notification_LeftChannel(_ _0: String) -> (String, [(Int, NSRange)]) { - return formatWithArgumentRanges(self._s[2694]!, self._r[2694]!, [_0]) + return formatWithArgumentRanges(self._s[2697]!, self._r[2697]!, [_0]) } public func Call_CallInProgressMessage(_ _1: String, _ _2: String) -> (String, [(Int, NSRange)]) { - return formatWithArgumentRanges(self._s[2695]!, self._r[2695]!, [_1, _2]) + return formatWithArgumentRanges(self._s[2698]!, self._r[2698]!, [_1, _2]) } - public var SaveIncomingPhotosSettings_From: String { return self._s[2697]! } - public var Map_LiveLocationTitle: String { return self._s[2698]! } - public var Login_InfoAvatarAdd: String { return self._s[2699]! } - public var Passport_Identity_FilesView: String { return self._s[2700]! } - public var UserInfo_GenericPhoneLabel: String { return self._s[2701]! } - public var Privacy_Calls_NeverAllow: String { return self._s[2702]! } + public var SaveIncomingPhotosSettings_From: String { return self._s[2700]! } + public var Map_LiveLocationTitle: String { return self._s[2701]! } + public var Login_InfoAvatarAdd: String { return self._s[2702]! } + public var Passport_Identity_FilesView: String { return self._s[2703]! } + public var UserInfo_GenericPhoneLabel: String { return self._s[2704]! } + public var Privacy_Calls_NeverAllow: String { return self._s[2705]! } public func Contacts_AddPhoneNumber(_ _0: String) -> (String, [(Int, NSRange)]) { - return formatWithArgumentRanges(self._s[2703]!, self._r[2703]!, [_0]) + return formatWithArgumentRanges(self._s[2706]!, self._r[2706]!, [_0]) } - public var TwoStepAuth_ConfirmationText: String { return self._s[2704]! } - public var ChatSettings_AutomaticVideoMessageDownload: String { return self._s[2705]! } - public var Channel_AdminLogFilter_AdminsAll: String { return self._s[2706]! } - public var Tour_Title2: String { return self._s[2707]! } - public var Conversation_FileOpenIn: String { return self._s[2708]! } - public var Checkout_ErrorPrecheckoutFailed: String { return self._s[2709]! } - public var Wallpaper_Set: String { return self._s[2710]! } - public var Passport_Identity_Translations: String { return self._s[2712]! } + public var TwoStepAuth_ConfirmationText: String { return self._s[2707]! } + public var ChatSettings_AutomaticVideoMessageDownload: String { return self._s[2708]! } + public var Channel_AdminLogFilter_AdminsAll: String { return self._s[2709]! } + public var Tour_Title2: String { return self._s[2710]! } + public var Conversation_FileOpenIn: String { return self._s[2711]! } + public var Checkout_ErrorPrecheckoutFailed: String { return self._s[2712]! } + public var Wallpaper_Set: String { return self._s[2713]! } + public var Passport_Identity_Translations: String { return self._s[2715]! } public func Channel_AdminLog_MessageChangedChannelAbout(_ _0: String) -> (String, [(Int, NSRange)]) { - return formatWithArgumentRanges(self._s[2713]!, self._r[2713]!, [_0]) + return formatWithArgumentRanges(self._s[2716]!, self._r[2716]!, [_0]) } - public var Channel_LeaveChannel: String { return self._s[2714]! } + public var Channel_LeaveChannel: String { return self._s[2717]! } public func PINNED_INVOICE(_ _1: String) -> (String, [(Int, NSRange)]) { - return formatWithArgumentRanges(self._s[2715]!, self._r[2715]!, [_1]) + return formatWithArgumentRanges(self._s[2718]!, self._r[2718]!, [_1]) } - public var PhotoEditor_HighlightsTint: String { return self._s[2716]! } - public var Passport_Email_Delete: String { return self._s[2717]! } - public var Conversation_Mute: String { return self._s[2719]! } - public var Channel_AdminLog_CanSendMessages: String { return self._s[2721]! } + public var PhotoEditor_HighlightsTint: String { return self._s[2719]! } + public var Passport_Email_Delete: String { return self._s[2720]! } + public var Conversation_Mute: String { return self._s[2722]! } + public var Channel_AdminLog_CanSendMessages: String { return self._s[2724]! } public func Notification_PassportValuesSentMessage(_ _1: String, _ _2: String) -> (String, [(Int, NSRange)]) { - return formatWithArgumentRanges(self._s[2722]!, self._r[2722]!, [_1, _2]) + return formatWithArgumentRanges(self._s[2725]!, self._r[2725]!, [_1, _2]) } - public var Calls_CallTabDescription: String { return self._s[2723]! } - public var Passport_Identity_NativeNameHelp: String { return self._s[2724]! } - public var Common_No: String { return self._s[2725]! } - public var Weekday_Sunday: String { return self._s[2726]! } - public var Notification_Reply: String { return self._s[2727]! } - public var Conversation_ViewMessage: String { return self._s[2728]! } + public var Calls_CallTabDescription: String { return self._s[2726]! } + public var Passport_Identity_NativeNameHelp: String { return self._s[2727]! } + public var Common_No: String { return self._s[2728]! } + public var Weekday_Sunday: String { return self._s[2729]! } + public var Notification_Reply: String { return self._s[2730]! } + public var Conversation_ViewMessage: String { return self._s[2731]! } public func Checkout_SavePasswordTimeoutAndFaceId(_ _0: String) -> (String, [(Int, NSRange)]) { - return formatWithArgumentRanges(self._s[2729]!, self._r[2729]!, [_0]) + return formatWithArgumentRanges(self._s[2732]!, self._r[2732]!, [_0]) } public func Map_LiveLocationPrivateDescription(_ _0: String) -> (String, [(Int, NSRange)]) { - return formatWithArgumentRanges(self._s[2730]!, self._r[2730]!, [_0]) + return formatWithArgumentRanges(self._s[2733]!, self._r[2733]!, [_0]) } - public var Message_PinnedDocumentMessage: String { return self._s[2731]! } - public var DialogList_TabTitle: String { return self._s[2733]! } - public var Passport_FieldEmail: String { return self._s[2734]! } - public var Conversation_UnpinMessageAlert: String { return self._s[2735]! } - public var Passport_Address_TypeBankStatement: String { return self._s[2736]! } - public var Passport_Identity_ExpiryDate: String { return self._s[2737]! } - public var Privacy_Calls_P2P: String { return self._s[2738]! } + public var Message_PinnedDocumentMessage: String { return self._s[2734]! } + public var DialogList_TabTitle: String { return self._s[2736]! } + public var Passport_FieldEmail: String { return self._s[2737]! } + public var Conversation_UnpinMessageAlert: String { return self._s[2738]! } + public var Passport_Address_TypeBankStatement: String { return self._s[2739]! } + public var Passport_Identity_ExpiryDate: String { return self._s[2740]! } + public var Privacy_Calls_P2P: String { return self._s[2741]! } public func CancelResetAccount_Success(_ _0: String) -> (String, [(Int, NSRange)]) { - return formatWithArgumentRanges(self._s[2740]!, self._r[2740]!, [_0]) + return formatWithArgumentRanges(self._s[2743]!, self._r[2743]!, [_0]) } - public var SocksProxySetup_UseForCallsHelp: String { return self._s[2741]! } - public var EnterPasscode_ChangeTitle: String { return self._s[2742]! } - public var Passport_InfoText: String { return self._s[2743]! } - public var Checkout_NewCard_SaveInfoEnableHelp: String { return self._s[2744]! } + public var SocksProxySetup_UseForCallsHelp: String { return self._s[2744]! } + public var EnterPasscode_ChangeTitle: String { return self._s[2745]! } + public var Passport_InfoText: String { return self._s[2746]! } + public var Checkout_NewCard_SaveInfoEnableHelp: String { return self._s[2747]! } public func Time_PreciseDate_m3(_ _1: String, _ _2: String, _ _3: String) -> (String, [(Int, NSRange)]) { - return formatWithArgumentRanges(self._s[2745]!, self._r[2745]!, [_1, _2, _3]) + return formatWithArgumentRanges(self._s[2748]!, self._r[2748]!, [_1, _2, _3]) } - public var Passport_Identity_EditDriversLicense: String { return self._s[2746]! } - public var Conversation_TapAndHoldToRecord: String { return self._s[2747]! } + public var Passport_Identity_EditDriversLicense: String { return self._s[2749]! } + public var Conversation_TapAndHoldToRecord: String { return self._s[2750]! } public func Notification_CallTimeFormat(_ _1: String, _ _2: String) -> (String, [(Int, NSRange)]) { - return formatWithArgumentRanges(self._s[2748]!, self._r[2748]!, [_1, _2]) + return formatWithArgumentRanges(self._s[2751]!, self._r[2751]!, [_1, _2]) } public func Generic_OpenHiddenLinkAlert(_ _0: String) -> (String, [(Int, NSRange)]) { - return formatWithArgumentRanges(self._s[2750]!, self._r[2750]!, [_0]) - } - public var DialogList_Unread: String { return self._s[2751]! } - public var User_DeletedAccount: String { return self._s[2752]! } - public func Watch_Time_ShortYesterdayAt(_ _0: String) -> (String, [(Int, NSRange)]) { return formatWithArgumentRanges(self._s[2753]!, self._r[2753]!, [_0]) } - public var UserInfo_NotificationsDefault: String { return self._s[2754]! } - public var SharedMedia_CategoryMedia: String { return self._s[2755]! } - public var SocksProxySetup_ProxyStatusUnavailable: String { return self._s[2756]! } - public var Channel_AdminLog_MessageRestrictedForever: String { return self._s[2757]! } - public var Watch_ChatList_Compose: String { return self._s[2758]! } - public var Notifications_MessageNotificationsExceptionsHelp: String { return self._s[2759]! } - public var Watch_Microphone_Access: String { return self._s[2760]! } - public var Group_Setup_HistoryHeader: String { return self._s[2761]! } - public var Activity_UploadingPhoto: String { return self._s[2762]! } - public var Conversation_Edit: String { return self._s[2764]! } - public var Group_ErrorSendRestrictedMedia: String { return self._s[2765]! } - public var Login_TermsOfServiceDecline: String { return self._s[2766]! } - public var Message_PinnedContactMessage: String { return self._s[2767]! } + public var DialogList_Unread: String { return self._s[2754]! } + public var User_DeletedAccount: String { return self._s[2755]! } + public func Watch_Time_ShortYesterdayAt(_ _0: String) -> (String, [(Int, NSRange)]) { + return formatWithArgumentRanges(self._s[2756]!, self._r[2756]!, [_0]) + } + public var UserInfo_NotificationsDefault: String { return self._s[2757]! } + public var SharedMedia_CategoryMedia: String { return self._s[2758]! } + public var SocksProxySetup_ProxyStatusUnavailable: String { return self._s[2759]! } + public var Channel_AdminLog_MessageRestrictedForever: String { return self._s[2760]! } + public var Watch_ChatList_Compose: String { return self._s[2761]! } + public var Notifications_MessageNotificationsExceptionsHelp: String { return self._s[2762]! } + public var Watch_Microphone_Access: String { return self._s[2763]! } + public var Group_Setup_HistoryHeader: String { return self._s[2764]! } + public var Activity_UploadingPhoto: String { return self._s[2765]! } + public var Conversation_Edit: String { return self._s[2767]! } + public var Group_ErrorSendRestrictedMedia: String { return self._s[2768]! } + public var Login_TermsOfServiceDecline: String { return self._s[2769]! } + public var Message_PinnedContactMessage: String { return self._s[2770]! } public func Channel_AdminLog_MessageRestrictedNameUsername(_ _1: String, _ _2: String) -> (String, [(Int, NSRange)]) { - return formatWithArgumentRanges(self._s[2768]!, self._r[2768]!, [_1, _2]) + return formatWithArgumentRanges(self._s[2771]!, self._r[2771]!, [_1, _2]) } - public var TwoStepAuth_AdditionalPassword: String { return self._s[2770]! } - public var Passport_Phone_EnterOtherNumber: String { return self._s[2771]! } - public var TwoStepAuth_RecoveryEmailAddDescription: String { return self._s[2772]! } - public var Passport_FieldPhone: String { return self._s[2773]! } - public var Message_PinnedPhotoMessage: String { return self._s[2774]! } - public var InfoPlist_NSCameraUsageDescription: String { return self._s[2776]! } - public var Conversation_Call: String { return self._s[2777]! } - public var Common_TakePhoto: String { return self._s[2779]! } - public var Channel_NotificationLoading: String { return self._s[2780]! } + public var TwoStepAuth_AdditionalPassword: String { return self._s[2773]! } + public var Passport_Phone_EnterOtherNumber: String { return self._s[2774]! } + public var TwoStepAuth_RecoveryEmailAddDescription: String { return self._s[2775]! } + public var Passport_FieldPhone: String { return self._s[2776]! } + public var Message_PinnedPhotoMessage: String { return self._s[2777]! } + public var InfoPlist_NSCameraUsageDescription: String { return self._s[2779]! } + public var Conversation_Call: String { return self._s[2780]! } + public var Common_TakePhoto: String { return self._s[2782]! } + public var Channel_NotificationLoading: String { return self._s[2783]! } public func Notification_Exceptions_Sound(_ _0: String) -> (String, [(Int, NSRange)]) { - return formatWithArgumentRanges(self._s[2781]!, self._r[2781]!, [_0]) + return formatWithArgumentRanges(self._s[2784]!, self._r[2784]!, [_0]) } + public var Permissions_SiriTitle_v0: String { return self._s[2785]! } public func Login_ResetAccountProtected_Text(_ _0: String) -> (String, [(Int, NSRange)]) { - return formatWithArgumentRanges(self._s[2782]!, self._r[2782]!, [_0]) + return formatWithArgumentRanges(self._s[2786]!, self._r[2786]!, [_0]) } - public var Channel_MessagePhotoRemoved: String { return self._s[2783]! } - public var Common_edit: String { return self._s[2784]! } - public var PrivacySettings_AuthSessions: String { return self._s[2785]! } - public var Month_ShortJune: String { return self._s[2786]! } - public var PrivacyLastSeenSettings_AlwaysShareWith_Placeholder: String { return self._s[2787]! } - public var Call_ReportSend: String { return self._s[2788]! } - public var Watch_LastSeen_JustNow: String { return self._s[2789]! } - public var Notifications_MessageNotifications: String { return self._s[2790]! } - public var BroadcastListInfo_AddRecipient: String { return self._s[2792]! } - public var Group_Status: String { return self._s[2793]! } + public var Channel_MessagePhotoRemoved: String { return self._s[2787]! } + public var Common_edit: String { return self._s[2788]! } + public var PrivacySettings_AuthSessions: String { return self._s[2789]! } + public var Month_ShortJune: String { return self._s[2790]! } + public var PrivacyLastSeenSettings_AlwaysShareWith_Placeholder: String { return self._s[2791]! } + public var Call_ReportSend: String { return self._s[2792]! } + public var Watch_LastSeen_JustNow: String { return self._s[2793]! } + public var Notifications_MessageNotifications: String { return self._s[2794]! } + public var BroadcastListInfo_AddRecipient: String { return self._s[2796]! } + public var Group_Status: String { return self._s[2797]! } public func AutoNightTheme_LocationHelp(_ _0: String, _ _1: String) -> (String, [(Int, NSRange)]) { - return formatWithArgumentRanges(self._s[2794]!, self._r[2794]!, [_0, _1]) + return formatWithArgumentRanges(self._s[2798]!, self._r[2798]!, [_0, _1]) } - public var ShareMenu_ShareTo: String { return self._s[2795]! } - public var Conversation_Moderate_Ban: String { return self._s[2796]! } + public var ShareMenu_ShareTo: String { return self._s[2799]! } + public var Conversation_Moderate_Ban: String { return self._s[2800]! } public func Conversation_DeleteMessagesFor(_ _0: String) -> (String, [(Int, NSRange)]) { - return formatWithArgumentRanges(self._s[2797]!, self._r[2797]!, [_0]) - } - public var SharedMedia_ViewInChat: String { return self._s[2798]! } - public var Map_LiveLocationFor8Hours: String { return self._s[2799]! } - public func Map_AccurateTo(_ _0: String) -> (String, [(Int, NSRange)]) { return formatWithArgumentRanges(self._s[2801]!, self._r[2801]!, [_0]) } - public var Appearance_ReduceMotion: String { return self._s[2802]! } - public var Map_OpenInHereMaps: String { return self._s[2803]! } - public var Channel_Setup_TypePublicHelp: String { return self._s[2804]! } - public var Passport_Identity_EditInternalPassport: String { return self._s[2805]! } - public var PhotoEditor_Skip: String { return self._s[2806]! } - public func SharedMedia_DeleteItemsConfirmation(_ value: Int32) -> String { + public var SharedMedia_ViewInChat: String { return self._s[2802]! } + public var Map_LiveLocationFor8Hours: String { return self._s[2803]! } + public func Map_AccurateTo(_ _0: String) -> (String, [(Int, NSRange)]) { + return formatWithArgumentRanges(self._s[2805]!, self._r[2805]!, [_0]) + } + public var Appearance_ReduceMotion: String { return self._s[2806]! } + public var Map_OpenInHereMaps: String { return self._s[2807]! } + public var Channel_Setup_TypePublicHelp: String { return self._s[2808]! } + public var Passport_Identity_EditInternalPassport: String { return self._s[2809]! } + public var PhotoEditor_Skip: String { return self._s[2810]! } + public func PrivacyLastSeenSettings_AddUsers(_ value: Int32) -> String { let form = presentationStringsPluralizationForm(self.lc, value) return String(format: self._ps[0 * 6 + Int(form.rawValue)]!, "\(value)") } - public func Contacts_ImportersCount(_ value: Int32) -> String { + public func ServiceMessage_GameScoreSelfSimple(_ value: Int32) -> String { let form = presentationStringsPluralizationForm(self.lc, value) return String(format: self._ps[1 * 6 + Int(form.rawValue)]!, "\(value)") } - public func ForwardedAudios(_ value: Int32) -> String { + public func Map_ETAHours(_ value: Int32) -> String { let form = presentationStringsPluralizationForm(self.lc, value) return String(format: self._ps[2 * 6 + Int(form.rawValue)]!, "\(value)") } - public func Notification_GameScoreSimple(_ value: Int32) -> String { + public func ForwardedContacts(_ value: Int32) -> String { let form = presentationStringsPluralizationForm(self.lc, value) return String(format: self._ps[3 * 6 + Int(form.rawValue)]!, "\(value)") } - public func StickerPack_StickerCount(_ value: Int32) -> String { + public func Forward_ConfirmMultipleFiles(_ value: Int32) -> String { let form = presentationStringsPluralizationForm(self.lc, value) return String(format: self._ps[4 * 6 + Int(form.rawValue)]!, "\(value)") } - public func Conversation_StatusSubscribers(_ value: Int32) -> String { + public func UserCount(_ value: Int32) -> String { let form = presentationStringsPluralizationForm(self.lc, value) return String(format: self._ps[5 * 6 + Int(form.rawValue)]!, "\(value)") } - public func ServiceMessage_GameScoreSelfExtended(_ value: Int32) -> String { + public func LastSeen_MinutesAgo(_ value: Int32) -> String { let form = presentationStringsPluralizationForm(self.lc, value) return String(format: self._ps[6 * 6 + Int(form.rawValue)]!, "\(value)") } - public func ChatList_DeleteConfirmation(_ value: Int32) -> String { + public func Media_ShareVideo(_ value: Int32) -> String { let form = presentationStringsPluralizationForm(self.lc, value) return String(format: self._ps[7 * 6 + Int(form.rawValue)]!, "\(value)") } - public func MuteFor_Days(_ value: Int32) -> String { + public func Notification_GameScoreSimple(_ value: Int32) -> String { let form = presentationStringsPluralizationForm(self.lc, value) return String(format: self._ps[8 * 6 + Int(form.rawValue)]!, "\(value)") } - public func Notification_GameScoreExtended(_ value: Int32) -> String { + public func Map_ETAMinutes(_ value: Int32) -> String { let form = presentationStringsPluralizationForm(self.lc, value) return String(format: self._ps[9 * 6 + Int(form.rawValue)]!, "\(value)") } - public func ForwardedContacts(_ value: Int32) -> String { + public func Notification_GameScoreExtended(_ value: Int32) -> String { let form = presentationStringsPluralizationForm(self.lc, value) return String(format: self._ps[10 * 6 + Int(form.rawValue)]!, "\(value)") } - public func Call_Minutes(_ value: Int32) -> String { + public func SharedMedia_Photo(_ value: Int32) -> String { let form = presentationStringsPluralizationForm(self.lc, value) return String(format: self._ps[11 * 6 + Int(form.rawValue)]!, "\(value)") } - public func Invitation_Members(_ value: Int32) -> String { + public func PasscodeSettings_FailedAttempts(_ value: Int32) -> String { let form = presentationStringsPluralizationForm(self.lc, value) return String(format: self._ps[12 * 6 + Int(form.rawValue)]!, "\(value)") } - public func Passport_Scans(_ value: Int32) -> String { + public func AttachmentMenu_SendVideo(_ value: Int32) -> String { let form = presentationStringsPluralizationForm(self.lc, value) return String(format: self._ps[13 * 6 + Int(form.rawValue)]!, "\(value)") } - public func ForwardedGifs(_ value: Int32) -> String { + public func Invitation_Members(_ value: Int32) -> String { let form = presentationStringsPluralizationForm(self.lc, value) return String(format: self._ps[14 * 6 + Int(form.rawValue)]!, "\(value)") } - public func AttachmentMenu_SendVideo(_ value: Int32) -> String { + public func ForwardedFiles(_ value: Int32) -> String { let form = presentationStringsPluralizationForm(self.lc, value) return String(format: self._ps[15 * 6 + Int(form.rawValue)]!, "\(value)") } - public func MessageTimer_Seconds(_ value: Int32) -> String { + public func AttachmentMenu_SendGif(_ value: Int32) -> String { let form = presentationStringsPluralizationForm(self.lc, value) return String(format: self._ps[16 * 6 + Int(form.rawValue)]!, "\(value)") } - public func Watch_UserInfo_Mute(_ value: Int32) -> String { + public func Call_Minutes(_ value: Int32) -> String { let form = presentationStringsPluralizationForm(self.lc, value) return String(format: self._ps[17 * 6 + Int(form.rawValue)]!, "\(value)") } - public func MessageTimer_ShortMinutes(_ value: Int32) -> String { + public func Passport_Scans(_ value: Int32) -> String { let form = presentationStringsPluralizationForm(self.lc, value) return String(format: self._ps[18 * 6 + Int(form.rawValue)]!, "\(value)") } - public func StickerPack_AddMaskCount(_ value: Int32) -> String { + public func ForwardedGifs(_ value: Int32) -> String { let form = presentationStringsPluralizationForm(self.lc, value) return String(format: self._ps[19 * 6 + Int(form.rawValue)]!, "\(value)") } - public func ForwardedVideoMessages(_ value: Int32) -> String { + public func ForwardedLocations(_ value: Int32) -> String { let form = presentationStringsPluralizationForm(self.lc, value) return String(format: self._ps[20 * 6 + Int(form.rawValue)]!, "\(value)") } - public func InviteText_ContactsCountText(_ value: Int32) -> String { + public func MuteFor_Days(_ value: Int32) -> String { let form = presentationStringsPluralizationForm(self.lc, value) return String(format: self._ps[21 * 6 + Int(form.rawValue)]!, "\(value)") } - public func StickerPack_AddStickerCount(_ value: Int32) -> String { + public func SharedMedia_DeleteItemsConfirmation(_ value: Int32) -> String { let form = presentationStringsPluralizationForm(self.lc, value) return String(format: self._ps[22 * 6 + Int(form.rawValue)]!, "\(value)") } - public func Notifications_ExceptionMuteExpires_Days(_ value: Int32) -> String { + public func AttachmentMenu_SendPhoto(_ value: Int32) -> String { let form = presentationStringsPluralizationForm(self.lc, value) return String(format: self._ps[23 * 6 + Int(form.rawValue)]!, "\(value)") } - public func LastSeen_HoursAgo(_ value: Int32) -> String { + public func LiveLocationUpdated_MinutesAgo(_ value: Int32) -> String { let form = presentationStringsPluralizationForm(self.lc, value) return String(format: self._ps[24 * 6 + Int(form.rawValue)]!, "\(value)") } - public func UserCount(_ value: Int32) -> String { + public func SharedMedia_Video(_ value: Int32) -> String { let form = presentationStringsPluralizationForm(self.lc, value) return String(format: self._ps[25 * 6 + Int(form.rawValue)]!, "\(value)") } - public func MessageTimer_Years(_ value: Int32) -> String { + public func ForwardedAuthorsOthers(_ value: Int32) -> String { let form = presentationStringsPluralizationForm(self.lc, value) return String(format: self._ps[26 * 6 + Int(form.rawValue)]!, "\(value)") } - public func ForwardedPhotos(_ value: Int32) -> String { + public func StickerPack_AddStickerCount(_ value: Int32) -> String { let form = presentationStringsPluralizationForm(self.lc, value) return String(format: self._ps[27 * 6 + Int(form.rawValue)]!, "\(value)") } - public func Call_Seconds(_ value: Int32) -> String { + public func StickerPack_StickerCount(_ value: Int32) -> String { let form = presentationStringsPluralizationForm(self.lc, value) return String(format: self._ps[28 * 6 + Int(form.rawValue)]!, "\(value)") } - public func LiveLocationUpdated_MinutesAgo(_ value: Int32) -> String { + public func QuickSend_Photos(_ value: Int32) -> String { let form = presentationStringsPluralizationForm(self.lc, value) return String(format: self._ps[29 * 6 + Int(form.rawValue)]!, "\(value)") } - public func ServiceMessage_GameScoreSimple(_ value: Int32) -> String { + public func MessageTimer_Hours(_ value: Int32) -> String { let form = presentationStringsPluralizationForm(self.lc, value) return String(format: self._ps[30 * 6 + Int(form.rawValue)]!, "\(value)") } - public func Media_SharePhoto(_ value: Int32) -> String { + public func MuteExpires_Minutes(_ value: Int32) -> String { let form = presentationStringsPluralizationForm(self.lc, value) return String(format: self._ps[31 * 6 + Int(form.rawValue)]!, "\(value)") } - public func Map_ETAHours(_ value: Int32) -> String { + public func SharedMedia_Link(_ value: Int32) -> String { let form = presentationStringsPluralizationForm(self.lc, value) return String(format: self._ps[32 * 6 + Int(form.rawValue)]!, "\(value)") } - public func Notifications_Exceptions(_ value: Int32) -> String { + public func MessageTimer_ShortMinutes(_ value: Int32) -> String { let form = presentationStringsPluralizationForm(self.lc, value) return String(format: self._ps[33 * 6 + Int(form.rawValue)]!, "\(value)") } - public func SharedMedia_Photo(_ value: Int32) -> String { + public func MuteExpires_Hours(_ value: Int32) -> String { let form = presentationStringsPluralizationForm(self.lc, value) return String(format: self._ps[34 * 6 + Int(form.rawValue)]!, "\(value)") } - public func Notifications_ExceptionMuteExpires_Hours(_ value: Int32) -> String { + public func ServiceMessage_GameScoreExtended(_ value: Int32) -> String { let form = presentationStringsPluralizationForm(self.lc, value) return String(format: self._ps[35 * 6 + Int(form.rawValue)]!, "\(value)") } - public func Conversation_StatusMembers(_ value: Int32) -> String { + public func Conversation_StatusSubscribers(_ value: Int32) -> String { let form = presentationStringsPluralizationForm(self.lc, value) return String(format: self._ps[36 * 6 + Int(form.rawValue)]!, "\(value)") } - public func Media_ShareItem(_ value: Int32) -> String { + public func ServiceMessage_GameScoreSelfExtended(_ value: Int32) -> String { let form = presentationStringsPluralizationForm(self.lc, value) return String(format: self._ps[37 * 6 + Int(form.rawValue)]!, "\(value)") } - public func GroupInfo_ParticipantCount(_ value: Int32) -> String { + public func Conversation_StatusOnline(_ value: Int32) -> String { let form = presentationStringsPluralizationForm(self.lc, value) return String(format: self._ps[38 * 6 + Int(form.rawValue)]!, "\(value)") } - public func MessageTimer_ShortWeeks(_ value: Int32) -> String { + public func LiveLocation_MenuChatsCount(_ value: Int32) -> String { let form = presentationStringsPluralizationForm(self.lc, value) return String(format: self._ps[39 * 6 + Int(form.rawValue)]!, "\(value)") } - public func StickerPack_RemoveMaskCount(_ value: Int32) -> String { + public func ForwardedVideos(_ value: Int32) -> String { let form = presentationStringsPluralizationForm(self.lc, value) return String(format: self._ps[40 * 6 + Int(form.rawValue)]!, "\(value)") } - public func Call_ShortSeconds(_ value: Int32) -> String { + public func MessageTimer_ShortHours(_ value: Int32) -> String { let form = presentationStringsPluralizationForm(self.lc, value) return String(format: self._ps[41 * 6 + Int(form.rawValue)]!, "\(value)") } - public func MuteExpires_Days(_ value: Int32) -> String { + public func Watch_LastSeen_HoursAgo(_ value: Int32) -> String { let form = presentationStringsPluralizationForm(self.lc, value) return String(format: self._ps[42 * 6 + Int(form.rawValue)]!, "\(value)") } - public func MessageTimer_Months(_ value: Int32) -> String { + public func StickerPack_AddMaskCount(_ value: Int32) -> String { let form = presentationStringsPluralizationForm(self.lc, value) return String(format: self._ps[43 * 6 + Int(form.rawValue)]!, "\(value)") } - public func ForwardedAuthorsOthers(_ value: Int32) -> String { + public func Media_SharePhoto(_ value: Int32) -> String { let form = presentationStringsPluralizationForm(self.lc, value) return String(format: self._ps[44 * 6 + Int(form.rawValue)]!, "\(value)") } - public func LiveLocation_MenuChatsCount(_ value: Int32) -> String { + public func Notifications_ExceptionMuteExpires_Minutes(_ value: Int32) -> String { let form = presentationStringsPluralizationForm(self.lc, value) return String(format: self._ps[45 * 6 + Int(form.rawValue)]!, "\(value)") } - public func SharedMedia_Link(_ value: Int32) -> String { + public func ForwardedStickers(_ value: Int32) -> String { let form = presentationStringsPluralizationForm(self.lc, value) return String(format: self._ps[46 * 6 + Int(form.rawValue)]!, "\(value)") } - public func Watch_LastSeen_MinutesAgo(_ value: Int32) -> String { + public func Call_Seconds(_ value: Int32) -> String { let form = presentationStringsPluralizationForm(self.lc, value) return String(format: self._ps[47 * 6 + Int(form.rawValue)]!, "\(value)") } - public func PrivacyLastSeenSettings_AddUsers(_ value: Int32) -> String { + public func Watch_UserInfo_Mute(_ value: Int32) -> String { let form = presentationStringsPluralizationForm(self.lc, value) return String(format: self._ps[48 * 6 + Int(form.rawValue)]!, "\(value)") } - public func Conversation_StatusOnline(_ value: Int32) -> String { + public func StickerPack_RemoveMaskCount(_ value: Int32) -> String { let form = presentationStringsPluralizationForm(self.lc, value) return String(format: self._ps[49 * 6 + Int(form.rawValue)]!, "\(value)") } - public func StickerPack_RemoveStickerCount(_ value: Int32) -> String { + public func MessageTimer_Years(_ value: Int32) -> String { let form = presentationStringsPluralizationForm(self.lc, value) return String(format: self._ps[50 * 6 + Int(form.rawValue)]!, "\(value)") } - public func ForwardedMessages(_ value: Int32) -> String { + public func Call_ShortMinutes(_ value: Int32) -> String { let form = presentationStringsPluralizationForm(self.lc, value) return String(format: self._ps[51 * 6 + Int(form.rawValue)]!, "\(value)") } - public func MuteExpires_Minutes(_ value: Int32) -> String { + public func Notifications_Exceptions(_ value: Int32) -> String { let form = presentationStringsPluralizationForm(self.lc, value) return String(format: self._ps[52 * 6 + Int(form.rawValue)]!, "\(value)") } - public func PasscodeSettings_FailedAttempts(_ value: Int32) -> String { + public func StickerPack_RemoveStickerCount(_ value: Int32) -> String { let form = presentationStringsPluralizationForm(self.lc, value) return String(format: self._ps[53 * 6 + Int(form.rawValue)]!, "\(value)") } - public func MessageTimer_ShortSeconds(_ value: Int32) -> String { + public func MuteFor_Hours(_ value: Int32) -> String { let form = presentationStringsPluralizationForm(self.lc, value) return String(format: self._ps[54 * 6 + Int(form.rawValue)]!, "\(value)") } - public func MessageTimer_ShortHours(_ value: Int32) -> String { + public func ServiceMessage_GameScoreSimple(_ value: Int32) -> String { let form = presentationStringsPluralizationForm(self.lc, value) return String(format: self._ps[55 * 6 + Int(form.rawValue)]!, "\(value)") } - public func MessageTimer_Weeks(_ value: Int32) -> String { + public func ForwardedAudios(_ value: Int32) -> String { let form = presentationStringsPluralizationForm(self.lc, value) return String(format: self._ps[56 * 6 + Int(form.rawValue)]!, "\(value)") } - public func ForwardedStickers(_ value: Int32) -> String { + public func LastSeen_HoursAgo(_ value: Int32) -> String { let form = presentationStringsPluralizationForm(self.lc, value) return String(format: self._ps[57 * 6 + Int(form.rawValue)]!, "\(value)") } - public func LastSeen_MinutesAgo(_ value: Int32) -> String { + public func MessageTimer_ShortWeeks(_ value: Int32) -> String { let form = presentationStringsPluralizationForm(self.lc, value) return String(format: self._ps[58 * 6 + Int(form.rawValue)]!, "\(value)") } - public func AttachmentMenu_SendPhoto(_ value: Int32) -> String { + public func Call_ShortSeconds(_ value: Int32) -> String { let form = presentationStringsPluralizationForm(self.lc, value) return String(format: self._ps[59 * 6 + Int(form.rawValue)]!, "\(value)") } - public func Call_ShortMinutes(_ value: Int32) -> String { + public func MuteExpires_Days(_ value: Int32) -> String { let form = presentationStringsPluralizationForm(self.lc, value) return String(format: self._ps[60 * 6 + Int(form.rawValue)]!, "\(value)") } - public func Forward_ConfirmMultipleFiles(_ value: Int32) -> String { + public func MessageTimer_Seconds(_ value: Int32) -> String { let form = presentationStringsPluralizationForm(self.lc, value) return String(format: self._ps[61 * 6 + Int(form.rawValue)]!, "\(value)") } - public func ServiceMessage_GameScoreSelfSimple(_ value: Int32) -> String { + public func Notification_GameScoreSelfSimple(_ value: Int32) -> String { let form = presentationStringsPluralizationForm(self.lc, value) return String(format: self._ps[62 * 6 + Int(form.rawValue)]!, "\(value)") } - public func SharedMedia_Video(_ value: Int32) -> String { + public func Conversation_LiveLocationMembersCount(_ value: Int32) -> String { let form = presentationStringsPluralizationForm(self.lc, value) return String(format: self._ps[63 * 6 + Int(form.rawValue)]!, "\(value)") } - public func ForwardedLocations(_ value: Int32) -> String { + public func MessageTimer_Minutes(_ value: Int32) -> String { let form = presentationStringsPluralizationForm(self.lc, value) return String(format: self._ps[64 * 6 + Int(form.rawValue)]!, "\(value)") } - public func MessageTimer_ShortDays(_ value: Int32) -> String { + public func InviteText_ContactsCountText(_ value: Int32) -> String { let form = presentationStringsPluralizationForm(self.lc, value) return String(format: self._ps[65 * 6 + Int(form.rawValue)]!, "\(value)") } - public func QuickSend_Photos(_ value: Int32) -> String { + public func MessageTimer_Months(_ value: Int32) -> String { let form = presentationStringsPluralizationForm(self.lc, value) return String(format: self._ps[66 * 6 + Int(form.rawValue)]!, "\(value)") } - public func Watch_LastSeen_HoursAgo(_ value: Int32) -> String { + public func Watch_LastSeen_MinutesAgo(_ value: Int32) -> String { let form = presentationStringsPluralizationForm(self.lc, value) return String(format: self._ps[67 * 6 + Int(form.rawValue)]!, "\(value)") } - public func SharedMedia_File(_ value: Int32) -> String { + public func AttachmentMenu_SendItem(_ value: Int32) -> String { let form = presentationStringsPluralizationForm(self.lc, value) return String(format: self._ps[68 * 6 + Int(form.rawValue)]!, "\(value)") } - public func Notification_GameScoreSelfSimple(_ value: Int32) -> String { + public func GroupInfo_ParticipantCount(_ value: Int32) -> String { let form = presentationStringsPluralizationForm(self.lc, value) return String(format: self._ps[69 * 6 + Int(form.rawValue)]!, "\(value)") } - public func ServiceMessage_GameScoreExtended(_ value: Int32) -> String { + public func Notifications_ExceptionMuteExpires_Days(_ value: Int32) -> String { let form = presentationStringsPluralizationForm(self.lc, value) return String(format: self._ps[70 * 6 + Int(form.rawValue)]!, "\(value)") } - public func MessageTimer_Minutes(_ value: Int32) -> String { + public func Notification_GameScoreSelfExtended(_ value: Int32) -> String { let form = presentationStringsPluralizationForm(self.lc, value) return String(format: self._ps[71 * 6 + Int(form.rawValue)]!, "\(value)") } - public func DialogList_LiveLocationChatsCount(_ value: Int32) -> String { + public func ChatList_DeleteConfirmation(_ value: Int32) -> String { let form = presentationStringsPluralizationForm(self.lc, value) return String(format: self._ps[72 * 6 + Int(form.rawValue)]!, "\(value)") } - public func Map_ETAMinutes(_ value: Int32) -> String { + public func MessageTimer_Days(_ value: Int32) -> String { let form = presentationStringsPluralizationForm(self.lc, value) return String(format: self._ps[73 * 6 + Int(form.rawValue)]!, "\(value)") } - public func MuteExpires_Hours(_ value: Int32) -> String { + public func ForwardedMessages(_ value: Int32) -> String { let form = presentationStringsPluralizationForm(self.lc, value) return String(format: self._ps[74 * 6 + Int(form.rawValue)]!, "\(value)") } - public func ForwardedVideos(_ value: Int32) -> String { + public func ForwardedVideoMessages(_ value: Int32) -> String { let form = presentationStringsPluralizationForm(self.lc, value) return String(format: self._ps[75 * 6 + Int(form.rawValue)]!, "\(value)") } - public func Conversation_LiveLocationMembersCount(_ value: Int32) -> String { + public func SharedMedia_File(_ value: Int32) -> String { let form = presentationStringsPluralizationForm(self.lc, value) return String(format: self._ps[76 * 6 + Int(form.rawValue)]!, "\(value)") } - public func Notifications_ExceptionMuteExpires_Minutes(_ value: Int32) -> String { + public func MessageTimer_ShortSeconds(_ value: Int32) -> String { let form = presentationStringsPluralizationForm(self.lc, value) return String(format: self._ps[77 * 6 + Int(form.rawValue)]!, "\(value)") } - public func Notification_GameScoreSelfExtended(_ value: Int32) -> String { + public func Media_ShareItem(_ value: Int32) -> String { let form = presentationStringsPluralizationForm(self.lc, value) return String(format: self._ps[78 * 6 + Int(form.rawValue)]!, "\(value)") } - public func AttachmentMenu_SendItem(_ value: Int32) -> String { + public func Conversation_StatusMembers(_ value: Int32) -> String { let form = presentationStringsPluralizationForm(self.lc, value) return String(format: self._ps[79 * 6 + Int(form.rawValue)]!, "\(value)") } - public func SharedMedia_Generic(_ value: Int32) -> String { + public func MessageTimer_Weeks(_ value: Int32) -> String { let form = presentationStringsPluralizationForm(self.lc, value) return String(format: self._ps[80 * 6 + Int(form.rawValue)]!, "\(value)") } - public func AttachmentMenu_SendGif(_ value: Int32) -> String { + public func SharedMedia_Generic(_ value: Int32) -> String { let form = presentationStringsPluralizationForm(self.lc, value) return String(format: self._ps[81 * 6 + Int(form.rawValue)]!, "\(value)") } - public func MuteFor_Hours(_ value: Int32) -> String { + public func Notifications_ExceptionMuteExpires_Hours(_ value: Int32) -> String { let form = presentationStringsPluralizationForm(self.lc, value) return String(format: self._ps[82 * 6 + Int(form.rawValue)]!, "\(value)") } - public func ForwardedFiles(_ value: Int32) -> String { + public func DialogList_LiveLocationChatsCount(_ value: Int32) -> String { let form = presentationStringsPluralizationForm(self.lc, value) return String(format: self._ps[83 * 6 + Int(form.rawValue)]!, "\(value)") } - public func MessageTimer_Days(_ value: Int32) -> String { + public func Contacts_ImportersCount(_ value: Int32) -> String { let form = presentationStringsPluralizationForm(self.lc, value) return String(format: self._ps[84 * 6 + Int(form.rawValue)]!, "\(value)") } - public func Media_ShareVideo(_ value: Int32) -> String { + public func ForwardedPhotos(_ value: Int32) -> String { let form = presentationStringsPluralizationForm(self.lc, value) return String(format: self._ps[85 * 6 + Int(form.rawValue)]!, "\(value)") } - public func MessageTimer_Hours(_ value: Int32) -> String { + public func MessageTimer_ShortDays(_ value: Int32) -> String { let form = presentationStringsPluralizationForm(self.lc, value) return String(format: self._ps[86 * 6 + Int(form.rawValue)]!, "\(value)") } diff --git a/TelegramUI/PresentationSurfaceLevels.swift b/TelegramUI/PresentationSurfaceLevels.swift index a0b56a461d..db5665f424 100644 --- a/TelegramUI/PresentationSurfaceLevels.swift +++ b/TelegramUI/PresentationSurfaceLevels.swift @@ -6,4 +6,5 @@ public extension PresentationSurfaceLevel { static let calls = PresentationSurfaceLevel(rawValue: 1) static let overlayMedia = PresentationSurfaceLevel(rawValue: 2) static let notifications = PresentationSurfaceLevel(rawValue: 3) + static let passcode = PresentationSurfaceLevel(rawValue: 4) } diff --git a/TelegramUI/ProxySettingsActionItem.swift b/TelegramUI/ProxySettingsActionItem.swift index bc821b1738..915af42e37 100644 --- a/TelegramUI/ProxySettingsActionItem.swift +++ b/TelegramUI/ProxySettingsActionItem.swift @@ -25,7 +25,7 @@ class ProxySettingsActionItem: ListViewItem, ItemListItem { self.action = action } - func nodeConfiguredForParams(async: @escaping (@escaping () -> Void) -> Void, params: ListViewItemLayoutParams, synchronousLoads: Bool, previousItem: ListViewItem?, nextItem: ListViewItem?, completion: @escaping (ListViewItemNode, @escaping () -> (Signal?, () -> Void)) -> Void) { + func nodeConfiguredForParams(async: @escaping (@escaping () -> Void) -> Void, params: ListViewItemLayoutParams, synchronousLoads: Bool, previousItem: ListViewItem?, nextItem: ListViewItem?, completion: @escaping (ListViewItemNode, @escaping () -> (Signal?, (ListViewItemApply) -> Void)) -> Void) { async { let node = ProxySettingsActionItemNode() let (layout, apply) = node.asyncLayout()(self, params, itemListNeighbors(item: self, topItem: previousItem as? ItemListItem, bottomItem: nextItem as? ItemListItem)) @@ -35,13 +35,13 @@ class ProxySettingsActionItem: ListViewItem, ItemListItem { Queue.mainQueue().async { completion(node, { - return (nil, { apply(false) }) + return (nil, { _ in apply(false) }) }) } } } - func updateNode(async: @escaping (@escaping () -> Void) -> Void, node: @escaping () -> ListViewItemNode, params: ListViewItemLayoutParams, previousItem: ListViewItem?, nextItem: ListViewItem?, animation: ListViewItemUpdateAnimation, completion: @escaping (ListViewItemNodeLayout, @escaping () -> Void) -> Void) { + func updateNode(async: @escaping (@escaping () -> Void) -> Void, node: @escaping () -> ListViewItemNode, params: ListViewItemLayoutParams, previousItem: ListViewItem?, nextItem: ListViewItem?, animation: ListViewItemUpdateAnimation, completion: @escaping (ListViewItemNodeLayout, @escaping (ListViewItemApply) -> Void) -> Void) { Queue.mainQueue().async { if let nodeValue = node() as? ProxySettingsActionItemNode { let makeLayout = nodeValue.asyncLayout() @@ -54,7 +54,7 @@ class ProxySettingsActionItem: ListViewItem, ItemListItem { async { let (layout, apply) = makeLayout(self, params, itemListNeighbors(item: self, topItem: previousItem as? ItemListItem, bottomItem: nextItem as? ItemListItem)) Queue.mainQueue().async { - completion(layout, { + completion(layout, { _ in apply(animated) }) } diff --git a/TelegramUI/ProxySettingsServerItem.swift b/TelegramUI/ProxySettingsServerItem.swift index 844e8a7961..ba4b403419 100644 --- a/TelegramUI/ProxySettingsServerItem.swift +++ b/TelegramUI/ProxySettingsServerItem.swift @@ -46,7 +46,7 @@ final class ProxySettingsServerItem: ListViewItem, ItemListItem { self.removeServer = removeServer } - func nodeConfiguredForParams(async: @escaping (@escaping () -> Void) -> Void, params: ListViewItemLayoutParams, synchronousLoads: Bool, previousItem: ListViewItem?, nextItem: ListViewItem?, completion: @escaping (ListViewItemNode, @escaping () -> (Signal?, () -> Void)) -> Void) { + func nodeConfiguredForParams(async: @escaping (@escaping () -> Void) -> Void, params: ListViewItemLayoutParams, synchronousLoads: Bool, previousItem: ListViewItem?, nextItem: ListViewItem?, completion: @escaping (ListViewItemNode, @escaping () -> (Signal?, (ListViewItemApply) -> Void)) -> Void) { async { let node = ProxySettingsServerItemNode() let (layout, apply) = node.asyncLayout()(self, params, itemListNeighbors(item: self, topItem: previousItem as? ItemListItem, bottomItem: nextItem as? ItemListItem)) @@ -56,13 +56,13 @@ final class ProxySettingsServerItem: ListViewItem, ItemListItem { Queue.mainQueue().async { completion(node, { - return (nil, { apply(false) }) + return (nil, { _ in apply(false) }) }) } } } - func updateNode(async: @escaping (@escaping () -> Void) -> Void, node: @escaping () -> ListViewItemNode, params: ListViewItemLayoutParams, previousItem: ListViewItem?, nextItem: ListViewItem?, animation: ListViewItemUpdateAnimation, completion: @escaping (ListViewItemNodeLayout, @escaping () -> Void) -> Void) { + func updateNode(async: @escaping (@escaping () -> Void) -> Void, node: @escaping () -> ListViewItemNode, params: ListViewItemLayoutParams, previousItem: ListViewItem?, nextItem: ListViewItem?, animation: ListViewItemUpdateAnimation, completion: @escaping (ListViewItemNodeLayout, @escaping (ListViewItemApply) -> Void) -> Void) { Queue.mainQueue().async { if let nodeValue = node() as? ProxySettingsServerItemNode { let makeLayout = nodeValue.asyncLayout() @@ -75,7 +75,7 @@ final class ProxySettingsServerItem: ListViewItem, ItemListItem { async { let (layout, apply) = makeLayout(self, params, itemListNeighbors(item: self, topItem: previousItem as? ItemListItem, bottomItem: nextItem as? ItemListItem)) Queue.mainQueue().async { - completion(layout, { + completion(layout, { _ in apply(animated) }) } diff --git a/TelegramUI/Resources/PresentationStrings.mapping b/TelegramUI/Resources/PresentationStrings.mapping index 960618d7a8..5901f94471 100644 Binary files a/TelegramUI/Resources/PresentationStrings.mapping and b/TelegramUI/Resources/PresentationStrings.mapping differ diff --git a/TelegramUI/SearchDisplayControllerContentNode.swift b/TelegramUI/SearchDisplayControllerContentNode.swift index 39003bd8d3..db743a6139 100644 --- a/TelegramUI/SearchDisplayControllerContentNode.swift +++ b/TelegramUI/SearchDisplayControllerContentNode.swift @@ -30,4 +30,7 @@ class SearchDisplayControllerContentNode: ASDisplayNode { func previewViewAndActionAtLocation(_ location: CGPoint) -> (UIView, Any)? { return nil } + + func scrollToTop() { + } } diff --git a/TelegramUI/SecretChatKeyController.swift b/TelegramUI/SecretChatKeyController.swift index 338d90a44f..4c3f657daf 100644 --- a/TelegramUI/SecretChatKeyController.swift +++ b/TelegramUI/SecretChatKeyController.swift @@ -24,6 +24,7 @@ final class SecretChatKeyController: ViewController { super.init(navigationBarPresentationData: NavigationBarPresentationData(presentationData: self.presentationData)) + self.statusBar.statusBarStyle = self.presentationData.theme.rootController.statusBar.style.style self.title = self.presentationData.strings.EncryptionKey_Title } diff --git a/TelegramUI/SecretMediaPreviewController.swift b/TelegramUI/SecretMediaPreviewController.swift index 518714373d..baa9ccab33 100644 --- a/TelegramUI/SecretMediaPreviewController.swift +++ b/TelegramUI/SecretMediaPreviewController.swift @@ -270,8 +270,12 @@ public final class SecretMediaPreviewController: ViewController { } } - if let _ = media as? TelegramMediaFile { - strongSelf.title = strongSelf.presentationData.strings.Message_Video + if let file = media as? TelegramMediaFile { + if file.isAnimated { + strongSelf.title = strongSelf.presentationData.strings.Message_Animation + } else { + strongSelf.title = strongSelf.presentationData.strings.Message_Video + } } else { strongSelf.title = strongSelf.presentationData.strings.Message_Photo } @@ -289,8 +293,12 @@ public final class SecretMediaPreviewController: ViewController { let contentNode = SecretMediaPreviewFooterContentNode() let peerTitle = messageMainPeer(message)?.compactDisplayTitle ?? "" let text: String - if let _ = media as? TelegramMediaFile { - text = strongSelf.presentationData.strings.SecretVideo_NotViewedYet(peerTitle).0 + if let file = media as? TelegramMediaFile { + if file.isAnimated { + text = strongSelf.presentationData.strings.SecretGIF_NotViewedYet(peerTitle).0 + } else { + text = strongSelf.presentationData.strings.SecretVideo_NotViewedYet(peerTitle).0 + } } else { text = strongSelf.presentationData.strings.SecretImage_NotViewedYet(peerTitle).0 } diff --git a/TelegramUI/SecureIdLocalResource.swift b/TelegramUI/SecureIdLocalResource.swift index 603ae015bf..9d35536a92 100644 --- a/TelegramUI/SecureIdLocalResource.swift +++ b/TelegramUI/SecureIdLocalResource.swift @@ -47,7 +47,7 @@ public class SecureIdLocalImageResource: TelegramMediaResource { return SecureIdLocalImageResourceId(id: self.localId) } - public func isEqual(to: TelegramMediaResource) -> Bool { + public func isEqual(to: MediaResource) -> Bool { if let to = to as? SecureIdLocalImageResource { return self.localId == to.localId && self.source.isEqual(to:to.source) } else { diff --git a/TelegramUI/SettingsController.swift b/TelegramUI/SettingsController.swift index b6520a8ec9..f614a36db7 100644 --- a/TelegramUI/SettingsController.swift +++ b/TelegramUI/SettingsController.swift @@ -497,7 +497,7 @@ public func settingsController(account: Account, accountManager: AccountManager) }) hiddenAvatarRepresentationDisposable.set((galleryController.hiddenMedia |> deliverOnMainQueue).start(next: { entry in - avatarAndNameInfoContext.hiddenAvatarRepresentation = entry?.representations.first + avatarAndNameInfoContext.hiddenAvatarRepresentation = entry?.representations.first?.representation updateHiddenAvatarImpl?() })) presentControllerImpl?(galleryController, AvatarGalleryControllerPresentationArguments(transitionArguments: { entry in diff --git a/TelegramUI/SettingsThemeWallpaperNode.swift b/TelegramUI/SettingsThemeWallpaperNode.swift index 37aee85688..c25bb45199 100644 --- a/TelegramUI/SettingsThemeWallpaperNode.swift +++ b/TelegramUI/SettingsThemeWallpaperNode.swift @@ -47,7 +47,7 @@ final class SettingsThemeWallpaperNode: ASDisplayNode { self.imageNode.isHidden = false self.backgroundNode.isHidden = true - let convertedRepresentations: [(TelegramMediaImageRepresentation, MediaResourceReference)] = representations.map({ ($0, .wallpaper(resource: $0.resource)) }) + let convertedRepresentations: [ImageRepresentationWithReference] = representations.map({ ImageRepresentationWithReference(representation: $0, reference: .wallpaper(resource: $0.resource)) }) self.imageNode.setSignal(chatAvatarGalleryPhoto(account: account, representations: convertedRepresentations, autoFetchFullSize: true)) let apply = self.imageNode.asyncLayout()(TransformImageArguments(corners: ImageCorners(), imageSize: largestImageRepresentation(representations)!.dimensions.aspectFilled(size), boundingSize: size, intrinsicInsets: UIEdgeInsets())) apply() diff --git a/TelegramUI/ShareController.swift b/TelegramUI/ShareController.swift index d986cbecf6..2e2c48973a 100644 --- a/TelegramUI/ShareController.swift +++ b/TelegramUI/ShareController.swift @@ -27,7 +27,7 @@ public enum ShareControllerSubject { case text(String) case quote(text: String, url: String) case messages([Message]) - case image([TelegramMediaImageRepresentation]) + case image([ImageRepresentationWithReference]) case media(AnyMediaReference) case mapMedia(TelegramMediaMap) case fromExternal(([PeerId], String) -> Signal) @@ -220,7 +220,7 @@ public final class ShareController: ViewController { case let .image(representations): if case .saveToCameraRoll = preferredAction { self.defaultAction = ShareControllerAction(title: self.presentationData.strings.Preview_SaveToCameraRoll, action: { [weak self] in - self?.saveToCameraRoll(image: representations) + self?.saveToCameraRoll(representations: representations) }) } case let .media(mediaReference): @@ -358,7 +358,7 @@ public final class ShareController: ViewController { if !text.isEmpty { messages.append(.message(text: text, attributes: [], mediaReference: nil, replyToMessageId: nil, localGroupingKey: nil)) } - messages.append(.message(text: "", attributes: [], mediaReference: .standalone(media: TelegramMediaImage(imageId: MediaId(namespace: Namespaces.Media.LocalImage, id: arc4random64()), representations: representations, reference: nil, partialReference: nil)), replyToMessageId: nil, localGroupingKey: nil)) + messages.append(.message(text: "", attributes: [], mediaReference: .standalone(media: TelegramMediaImage(imageId: MediaId(namespace: Namespaces.Media.LocalImage, id: arc4random64()), representations: representations.map({ $0.representation }), reference: nil, partialReference: nil)), replyToMessageId: nil, localGroupingKey: nil)) let _ = enqueueMessages(account: strongSelf.account, peerId: peerId, messages: messages).start() } return .complete() @@ -421,7 +421,7 @@ public final class ShareController: ViewController { case let .quote(text, url): collectableItems.append(CollectableExternalShareItem(url: "", text: "\"\(text)\"\n\n\(url)", mediaReference: nil)) case let .image(representations): - let media = TelegramMediaImage(imageId: MediaId(namespace: Namespaces.Media.LocalImage, id: arc4random64()), representations: representations, reference: nil, partialReference: nil) + let media = TelegramMediaImage(imageId: MediaId(namespace: Namespaces.Media.LocalImage, id: arc4random64()), representations: representations.map({ $0.representation }), reference: nil, partialReference: nil) collectableItems.append(CollectableExternalShareItem(url: "", text: "", mediaReference: .standalone(media: media))) case let .media(mediaReference): collectableItems.append(CollectableExternalShareItem(url: "", text: "", mediaReference: mediaReference)) @@ -543,8 +543,8 @@ public final class ShareController: ViewController { } } - private func saveToCameraRoll(image: [TelegramMediaImageRepresentation]) { - let media = TelegramMediaImage(imageId: MediaId(namespace: 0, id: 0), representations: image, reference: nil, partialReference: nil) + private func saveToCameraRoll(representations: [ImageRepresentationWithReference]) { + let media = TelegramMediaImage(imageId: MediaId(namespace: 0, id: 0), representations: representations.map({ $0.representation }), reference: nil, partialReference: nil) self.controllerNode.transitionToProgress(signal: TelegramUI.saveToCameraRoll(applicationContext: self.account.telegramApplicationContext, postbox: self.account.postbox, mediaReference: .standalone(media: media))) } diff --git a/TelegramUI/SharedMediaPlayer.swift b/TelegramUI/SharedMediaPlayer.swift index 17efeec200..d000f1a509 100644 --- a/TelegramUI/SharedMediaPlayer.swift +++ b/TelegramUI/SharedMediaPlayer.swift @@ -189,11 +189,12 @@ protocol SharedMediaPlaylistLocation { func isEqual(to: SharedMediaPlaylistLocation) -> Bool } -protocol SharedMediaPlaylist { +protocol SharedMediaPlaylist: class { var id: SharedMediaPlaylistId { get } var location: SharedMediaPlaylistLocation { get } var state: Signal { get } var looping: MusicPlaybackSettingsLooping { get } + var currentItemDisappeared: (() -> Void)? { get set } func control(_ action: SharedMediaPlaylistControlAction) func setOrder(_ order: MusicPlaybackSettingsOrder) @@ -405,6 +406,7 @@ final class SharedMediaPlayer { private let markItemAsPlayedDisposable = MetaDisposable() var playedToEnd: (() -> Void)? + var cancelled: (() -> Void)? private var inForegroundDisposable: Disposable? @@ -427,6 +429,10 @@ final class SharedMediaPlayer { self.forceAudioToSpeaker = !DeviceProximityManager.shared().currentValue() } + playlist.currentItemDisappeared = { [weak self] in + self?.cancelled?() + } + self.stateDisposable = (playlist.state |> deliverOnMainQueue).start(next: { [weak self] state in if let strongSelf = self { diff --git a/TelegramUI/StickerPaneSearchContainerNode.swift b/TelegramUI/StickerPaneSearchContainerNode.swift index c930656561..412de32b4c 100644 --- a/TelegramUI/StickerPaneSearchContainerNode.swift +++ b/TelegramUI/StickerPaneSearchContainerNode.swift @@ -153,6 +153,11 @@ final class StickerPaneSearchContainerNode: ASDisplayNode { private let searchDisposable = MetaDisposable() + private let _ready = Promise() + var ready: Signal { + return self._ready.get() + } + init(account: Account, theme: PresentationTheme, strings: PresentationStrings, controllerInteraction: ChatControllerInteraction, inputNodeInteraction: ChatMediaInputNodeInteraction, cancel: @escaping () -> Void) { self.account = account self.theme = theme @@ -218,21 +223,21 @@ final class StickerPaneSearchContainerNode: ASDisplayNode { }, install: { [weak self] info in if let strongSelf = self { let _ = (loadedStickerPack(postbox: strongSelf.account.postbox, network: strongSelf.account.network, reference: .id(id: info.id.id, accessHash: info.accessHash), forceActualized: false) - |> mapToSignal { result -> Signal in - switch result { - case let .result(info, items, installed): - if installed { - return .complete() - } else { - return addStickerPackInteractively(postbox: strongSelf.account.postbox, info: info, items: items) - } - case .fetching: - break - case .none: - break - } - return .complete() - }).start() + |> mapToSignal { result -> Signal in + switch result { + case let .result(info, items, installed): + if installed { + return .complete() + } else { + return addStickerPackInteractively(postbox: strongSelf.account.postbox, info: info, items: items) + } + case .fetching: + break + case .none: + break + } + return .complete() + }).start() } }, sendSticker: { [weak self] file in if let strongSelf = self { @@ -363,6 +368,9 @@ final class StickerPaneSearchContainerNode: ASDisplayNode { } })) } + + self._ready.set(self.trendingPane.ready) + self.trendingPane.activate() } deinit { @@ -392,7 +400,7 @@ final class StickerPaneSearchContainerNode: ASDisplayNode { self.gridNode.transaction(GridNodeTransaction(deleteItems: [], insertItems: [], updateItems: [], scrollToItem: nil, updateLayout: GridNodeUpdateLayout(layout: GridNodeLayout(size: contentFrame.size, insets: UIEdgeInsets(top: 4.0, left: 0.0, bottom: 4.0 + bottomInset, right: 0.0), preloadSize: 300.0, type: .fixed(itemSize: CGSize(width: 75.0, height: 75.0), fillWidth: nil, lineSpacing: 0.0, itemSpacing: nil)), transition: transition), itemTransition: .immediate, stationaryItems: .none, updateFirstIndexInSectionOffset: nil), completion: { _ in }) transition.updateFrame(node: self.trendingPane, frame: contentFrame) - self.trendingPane.updateLayout(size: contentFrame.size, topInset: 0.0, bottomInset: bottomInset, isExpanded: false, transition: transition) + self.trendingPane.updateLayout(size: contentFrame.size, topInset: 0.0, bottomInset: bottomInset, isExpanded: false, isVisible: true, transition: transition) transition.updateFrame(node: self.gridNode, frame: contentFrame) if firstLayout { diff --git a/TelegramUI/StickerResources.swift b/TelegramUI/StickerResources.swift index 27dc9a278d..49cd5ba7e8 100644 --- a/TelegramUI/StickerResources.swift +++ b/TelegramUI/StickerResources.swift @@ -44,11 +44,11 @@ func chatMessageStickerResource(file: TelegramMediaFile, small: Bool) -> MediaRe return resource } -private func chatMessageStickerDatas(postbox: Postbox, file: TelegramMediaFile, small: Bool, fetched: Bool, onlyFullSize: Bool) -> Signal<(Data?, Data?, Bool), NoError> { +private func chatMessageStickerDatas(postbox: Postbox, file: TelegramMediaFile, small: Bool, fetched: Bool, onlyFullSize: Bool, synchronousLoad: Bool) -> Signal<(Data?, Data?, Bool), NoError> { let thumbnailResource = chatMessageStickerResource(file: file, small: true) let resource = chatMessageStickerResource(file: file, small: small) - let maybeFetched = postbox.mediaBox.cachedResourceRepresentation(resource, representation: CachedStickerAJpegRepresentation(size: small ? CGSize(width: 160.0, height: 160.0) : nil), complete: false, fetch: false) + let maybeFetched = postbox.mediaBox.cachedResourceRepresentation(resource, representation: CachedStickerAJpegRepresentation(size: small ? CGSize(width: 160.0, height: 160.0) : nil), complete: false, fetch: false, attemptSynchronously: synchronousLoad) return maybeFetched |> take(1) @@ -95,8 +95,29 @@ private func chatMessageStickerDatas(postbox: Postbox, file: TelegramMediaFile, } } +func chatMessageAnimatedStickerDatas(postbox: Postbox, fileReference: FileMediaReference, synchronousLoad: Bool) -> Signal<(Data?, Bool), NoError> { + let resource = fileReference.media.resource + + let maybeFetched = postbox.mediaBox.resourceData(resource, option: .complete(waitUntilFetchStatus: false), attemptSynchronously: synchronousLoad) + + return maybeFetched + |> take(1) + |> mapToSignal { maybeData in + if maybeData.complete { + let loadedData: Data? = try? Data(contentsOf: URL(fileURLWithPath: maybeData.path), options: []) + return .single((loadedData, true)) + } else { + let fullSizeData = postbox.mediaBox.resourceData(resource, option: .complete(waitUntilFetchStatus: false), attemptSynchronously: synchronousLoad) + |> map { next -> (Data?, Bool) in + return (next.size == 0 ? nil : try? Data(contentsOf: URL(fileURLWithPath: next.path), options: []), next.complete) + } + return fullSizeData + } + } +} + func chatMessageLegacySticker(account: Account, file: TelegramMediaFile, small: Bool, fitSize: CGSize, fetched: Bool = false, onlyFullSize: Bool = false) -> Signal<(TransformImageArguments) -> DrawingContext?, NoError> { - let signal = chatMessageStickerDatas(postbox: account.postbox, file: file, small: small, fetched: fetched, onlyFullSize: onlyFullSize) + let signal = chatMessageStickerDatas(postbox: account.postbox, file: file, small: small, fetched: fetched, onlyFullSize: onlyFullSize, synchronousLoad: false) return signal |> map { (thumbnailData, fullSizeData, fullSizeComplete) in return { preArguments in var fullSizeImage: (UIImage, UIImage)? @@ -159,12 +180,12 @@ func chatMessageLegacySticker(account: Account, file: TelegramMediaFile, small: } } -public func chatMessageSticker(account: Account, file: TelegramMediaFile, small: Bool, fetched: Bool = false, onlyFullSize: Bool = false) -> Signal<(TransformImageArguments) -> DrawingContext?, NoError> { - return chatMessageSticker(postbox: account.postbox, file: file, small: small, fetched: fetched, onlyFullSize: onlyFullSize) +public func chatMessageSticker(account: Account, file: TelegramMediaFile, small: Bool, fetched: Bool = false, onlyFullSize: Bool = false, synchronousLoad: Bool = false) -> Signal<(TransformImageArguments) -> DrawingContext?, NoError> { + return chatMessageSticker(postbox: account.postbox, file: file, small: small, fetched: fetched, onlyFullSize: onlyFullSize, synchronousLoad: synchronousLoad) } -public func chatMessageSticker(postbox: Postbox, file: TelegramMediaFile, small: Bool, fetched: Bool = false, onlyFullSize: Bool = false) -> Signal<(TransformImageArguments) -> DrawingContext?, NoError> { - let signal = chatMessageStickerDatas(postbox: postbox, file: file, small: small, fetched: fetched, onlyFullSize: onlyFullSize) +public func chatMessageSticker(postbox: Postbox, file: TelegramMediaFile, small: Bool, fetched: Bool = false, onlyFullSize: Bool = false, synchronousLoad: Bool = false) -> Signal<(TransformImageArguments) -> DrawingContext?, NoError> { + let signal = chatMessageStickerDatas(postbox: postbox, file: file, small: small, fetched: fetched, onlyFullSize: onlyFullSize, synchronousLoad: synchronousLoad) return signal |> map { (thumbnailData, fullSizeData, fullSizeComplete) in return { arguments in diff --git a/TelegramUI/TelegramApplicationContext.swift b/TelegramUI/TelegramApplicationContext.swift index ad5eda4f69..ad0dfbe231 100644 --- a/TelegramUI/TelegramApplicationContext.swift +++ b/TelegramUI/TelegramApplicationContext.swift @@ -26,12 +26,12 @@ public final class TelegramApplicationBindings { public let pushIdleTimerExtension: () -> Disposable public let openSettings: () -> Void public let openAppStorePage: () -> Void - public let registerForNotifications: () -> Void + public let registerForNotifications: ((Bool) -> Void) -> Void public let getWindowHost: () -> WindowHost? public let presentNativeController: (UIViewController) -> Void public let dismissNativeController: () -> Void - public init(isMainApp: Bool, openUrl: @escaping (String) -> Void, openUniversalUrl: @escaping (String, TelegramApplicationOpenUrlCompletion) -> Void, canOpenUrl: @escaping (String) -> Bool, getTopWindow: @escaping () -> UIWindow?, displayNotification: @escaping (String) -> Void, applicationInForeground: Signal, applicationIsActive: Signal, clearMessageNotifications: @escaping ([MessageId]) -> Void, pushIdleTimerExtension: @escaping () -> Disposable, openSettings: @escaping () -> Void, openAppStorePage: @escaping () -> Void, registerForNotifications: @escaping () -> Void, getWindowHost: @escaping () -> WindowHost?, presentNativeController: @escaping (UIViewController) -> Void, dismissNativeController: @escaping () -> Void) { + public init(isMainApp: Bool, openUrl: @escaping (String) -> Void, openUniversalUrl: @escaping (String, TelegramApplicationOpenUrlCompletion) -> Void, canOpenUrl: @escaping (String) -> Bool, getTopWindow: @escaping () -> UIWindow?, displayNotification: @escaping (String) -> Void, applicationInForeground: Signal, applicationIsActive: Signal, clearMessageNotifications: @escaping ([MessageId]) -> Void, pushIdleTimerExtension: @escaping () -> Disposable, openSettings: @escaping () -> Void, openAppStorePage: @escaping () -> Void, registerForNotifications: @escaping ((Bool) -> Void) -> Void, getWindowHost: @escaping () -> WindowHost?, presentNativeController: @escaping (UIViewController) -> Void, dismissNativeController: @escaping () -> Void) { self.isMainApp = isMainApp self.openUrl = openUrl self.openUniversalUrl = openUniversalUrl @@ -114,6 +114,9 @@ public final class TelegramApplicationContext { public var isCurrent: Bool = false { didSet { self.mediaManager?.isCurrent = self.isCurrent + if !self.isCurrent { + self.callManager = nil + } } } diff --git a/TelegramUI/TelegramInitializeLegacyComponents.swift b/TelegramUI/TelegramInitializeLegacyComponents.swift index 8eda49e3ee..307c387b0e 100644 --- a/TelegramUI/TelegramInitializeLegacyComponents.swift +++ b/TelegramUI/TelegramInitializeLegacyComponents.swift @@ -219,7 +219,7 @@ private final class LegacyComponentsGlobalsProviderImpl: NSObject, LegacyCompone let convertedType: ManagedAudioSessionType switch type { case TGAudioSessionTypePlayAndRecord, TGAudioSessionTypePlayAndRecordHeadphones: - convertedType = .record + convertedType = .record(speaker: false) default: convertedType = .play } diff --git a/TelegramUI/TelegramUIPrivate/module.modulemap b/TelegramUI/TelegramUIPrivate/module.modulemap index ac0f82cc19..cab446b48e 100644 --- a/TelegramUI/TelegramUIPrivate/module.modulemap +++ b/TelegramUI/TelegramUIPrivate/module.modulemap @@ -31,4 +31,6 @@ module TelegramUIPrivateModule { header "../TGBridgeAudioDecoder.h" header "../TGBridgeAudioEncoder.h" header "../ID3Artwork.h" + private header "../../third-party/libjpeg-turbo/turbojpeg.h" + private header "../../third-party/libjpeg-turbo/jpeglib.h" } diff --git a/TelegramUI/ThemeGalleryItem.swift b/TelegramUI/ThemeGalleryItem.swift index 951ed0b518..254281d5e2 100644 --- a/TelegramUI/ThemeGalleryItem.swift +++ b/TelegramUI/ThemeGalleryItem.swift @@ -95,12 +95,12 @@ final class ThemeGalleryItemNode: ZoomableContentGalleryItemNode { let displaySize = largestSize.dimensions.fitted(CGSize(width: 1280.0, height: 1280.0)).dividedByScreenScale().integralFloor self.imageNode.asyncLayout()(TransformImageArguments(corners: ImageCorners(), imageSize: displaySize, boundingSize: displaySize, intrinsicInsets: UIEdgeInsets()))() - let convertedRepresentations: [(TelegramMediaImageRepresentation, MediaResourceReference)] = representations.map({ ($0, .wallpaper(resource: $0.resource)) }) + let convertedRepresentations: [ImageRepresentationWithReference] = representations.map({ ImageRepresentationWithReference(representation: $0, reference: .wallpaper(resource: $0.resource)) }) self.imageNode.setSignal(chatAvatarGalleryPhoto(account: account, representations: convertedRepresentations), dispatchOnDisplayLink: false) self.zoomableContent = (largestSize.dimensions, self.imageNode) - if let largestIndex = convertedRepresentations.index(where: { $0.0 == largestSize }) { - self.fetchDisposable.set(fetchedMediaResource(postbox: self.account.postbox, reference: convertedRepresentations[largestIndex].1).start()) + if let largestIndex = convertedRepresentations.index(where: { $0.representation == largestSize }) { + self.fetchDisposable.set(fetchedMediaResource(postbox: self.account.postbox, reference: convertedRepresentations[largestIndex].reference).start()) } } else { self._ready.set(.single(Void())) diff --git a/TelegramUI/ThemeSettingsBrightnessItem.swift b/TelegramUI/ThemeSettingsBrightnessItem.swift index 9d5ce82c7f..5dea635f87 100644 --- a/TelegramUI/ThemeSettingsBrightnessItem.swift +++ b/TelegramUI/ThemeSettingsBrightnessItem.swift @@ -19,7 +19,7 @@ class ThemeSettingsBrightnessItem: ListViewItem, ItemListItem { self.updated = updated } - func nodeConfiguredForParams(async: @escaping (@escaping () -> Void) -> Void, params: ListViewItemLayoutParams, synchronousLoads: Bool, previousItem: ListViewItem?, nextItem: ListViewItem?, completion: @escaping (ListViewItemNode, @escaping () -> (Signal?, () -> Void)) -> Void) { + func nodeConfiguredForParams(async: @escaping (@escaping () -> Void) -> Void, params: ListViewItemLayoutParams, synchronousLoads: Bool, previousItem: ListViewItem?, nextItem: ListViewItem?, completion: @escaping (ListViewItemNode, @escaping () -> (Signal?, (ListViewItemApply) -> Void)) -> Void) { async { let node = ThemeSettingsBrightnessItemNode() let (layout, apply) = node.asyncLayout()(self, params, itemListNeighbors(item: self, topItem: previousItem as? ItemListItem, bottomItem: nextItem as? ItemListItem)) @@ -29,13 +29,13 @@ class ThemeSettingsBrightnessItem: ListViewItem, ItemListItem { Queue.mainQueue().async { completion(node, { - return (nil, { apply() }) + return (nil, { _ in apply() }) }) } } } - func updateNode(async: @escaping (@escaping () -> Void) -> Void, node: @escaping () -> ListViewItemNode, params: ListViewItemLayoutParams, previousItem: ListViewItem?, nextItem: ListViewItem?, animation: ListViewItemUpdateAnimation, completion: @escaping (ListViewItemNodeLayout, @escaping () -> Void) -> Void) { + func updateNode(async: @escaping (@escaping () -> Void) -> Void, node: @escaping () -> ListViewItemNode, params: ListViewItemLayoutParams, previousItem: ListViewItem?, nextItem: ListViewItem?, animation: ListViewItemUpdateAnimation, completion: @escaping (ListViewItemNodeLayout, @escaping (ListViewItemApply) -> Void) -> Void) { Queue.mainQueue().async { if let nodeValue = node() as? ThemeSettingsBrightnessItemNode { let makeLayout = nodeValue.asyncLayout() @@ -43,7 +43,7 @@ class ThemeSettingsBrightnessItem: ListViewItem, ItemListItem { async { let (layout, apply) = makeLayout(self, params, itemListNeighbors(item: self, topItem: previousItem as? ItemListItem, bottomItem: nextItem as? ItemListItem)) Queue.mainQueue().async { - completion(layout, { + completion(layout, { _ in apply() }) } diff --git a/TelegramUI/ThemeSettingsChatPreviewItem.swift b/TelegramUI/ThemeSettingsChatPreviewItem.swift index a563e6c47d..e51dbae6cc 100644 --- a/TelegramUI/ThemeSettingsChatPreviewItem.swift +++ b/TelegramUI/ThemeSettingsChatPreviewItem.swift @@ -26,7 +26,7 @@ class ThemeSettingsChatPreviewItem: ListViewItem, ItemListItem { self.dateTimeFormat = dateTimeFormat } - func nodeConfiguredForParams(async: @escaping (@escaping () -> Void) -> Void, params: ListViewItemLayoutParams, synchronousLoads: Bool, previousItem: ListViewItem?, nextItem: ListViewItem?, completion: @escaping (ListViewItemNode, @escaping () -> (Signal?, () -> Void)) -> Void) { + func nodeConfiguredForParams(async: @escaping (@escaping () -> Void) -> Void, params: ListViewItemLayoutParams, synchronousLoads: Bool, previousItem: ListViewItem?, nextItem: ListViewItem?, completion: @escaping (ListViewItemNode, @escaping () -> (Signal?, (ListViewItemApply) -> Void)) -> Void) { async { let node = ThemeSettingsChatPreviewItemNode() let (layout, apply) = node.asyncLayout()(self, params, itemListNeighbors(item: self, topItem: previousItem as? ItemListItem, bottomItem: nextItem as? ItemListItem)) @@ -36,13 +36,13 @@ class ThemeSettingsChatPreviewItem: ListViewItem, ItemListItem { Queue.mainQueue().async { completion(node, { - return (nil, { apply() }) + return (nil, { _ in apply() }) }) } } } - func updateNode(async: @escaping (@escaping () -> Void) -> Void, node: @escaping () -> ListViewItemNode, params: ListViewItemLayoutParams, previousItem: ListViewItem?, nextItem: ListViewItem?, animation: ListViewItemUpdateAnimation, completion: @escaping (ListViewItemNodeLayout, @escaping () -> Void) -> Void) { + func updateNode(async: @escaping (@escaping () -> Void) -> Void, node: @escaping () -> ListViewItemNode, params: ListViewItemLayoutParams, previousItem: ListViewItem?, nextItem: ListViewItem?, animation: ListViewItemUpdateAnimation, completion: @escaping (ListViewItemNodeLayout, @escaping (ListViewItemApply) -> Void) -> Void) { Queue.mainQueue().async { if let nodeValue = node() as? ThemeSettingsChatPreviewItemNode { let makeLayout = nodeValue.asyncLayout() @@ -50,7 +50,7 @@ class ThemeSettingsChatPreviewItem: ListViewItem, ItemListItem { async { let (layout, apply) = makeLayout(self, params, itemListNeighbors(item: self, topItem: previousItem as? ItemListItem, bottomItem: nextItem as? ItemListItem)) Queue.mainQueue().async { - completion(layout, { + completion(layout, { _ in apply() }) } @@ -166,12 +166,12 @@ class ThemeSettingsChatPreviewItemNode: ListViewItemNode { current.insets = layout.insets current.frame = nodeFrame - apply() + apply(ListViewItemApply(isOnScreen: true)) }) } else { item1.nodeConfiguredForParams(async: { $0() }, params: params, synchronousLoads: false, previousItem: nil, nextItem: nil, completion: { node, apply in node1 = node - apply().1() + apply().1(ListViewItemApply(isOnScreen: true)) }) } @@ -185,12 +185,12 @@ class ThemeSettingsChatPreviewItemNode: ListViewItemNode { current.insets = layout.insets current.frame = nodeFrame - apply() + apply(ListViewItemApply(isOnScreen: true)) }) } else { item2.nodeConfiguredForParams(async: { $0() }, params: params, synchronousLoads: false, previousItem: nil, nextItem: nil, completion: { node, apply in node2 = node - apply().1() + apply().1(ListViewItemApply(isOnScreen: true)) }) } diff --git a/TelegramUI/ThemeSettingsFontSizeItem.swift b/TelegramUI/ThemeSettingsFontSizeItem.swift index af902e49fb..a31ec581f2 100644 --- a/TelegramUI/ThemeSettingsFontSizeItem.swift +++ b/TelegramUI/ThemeSettingsFontSizeItem.swift @@ -19,7 +19,7 @@ class ThemeSettingsFontSizeItem: ListViewItem, ItemListItem { self.updated = updated } - func nodeConfiguredForParams(async: @escaping (@escaping () -> Void) -> Void, params: ListViewItemLayoutParams, synchronousLoads: Bool, previousItem: ListViewItem?, nextItem: ListViewItem?, completion: @escaping (ListViewItemNode, @escaping () -> (Signal?, () -> Void)) -> Void) { + func nodeConfiguredForParams(async: @escaping (@escaping () -> Void) -> Void, params: ListViewItemLayoutParams, synchronousLoads: Bool, previousItem: ListViewItem?, nextItem: ListViewItem?, completion: @escaping (ListViewItemNode, @escaping () -> (Signal?, (ListViewItemApply) -> Void)) -> Void) { async { let node = ThemeSettingsFontSizeItemNode() let (layout, apply) = node.asyncLayout()(self, params, itemListNeighbors(item: self, topItem: previousItem as? ItemListItem, bottomItem: nextItem as? ItemListItem)) @@ -29,13 +29,13 @@ class ThemeSettingsFontSizeItem: ListViewItem, ItemListItem { Queue.mainQueue().async { completion(node, { - return (nil, { apply() }) + return (nil, { _ in apply() }) }) } } } - func updateNode(async: @escaping (@escaping () -> Void) -> Void, node: @escaping () -> ListViewItemNode, params: ListViewItemLayoutParams, previousItem: ListViewItem?, nextItem: ListViewItem?, animation: ListViewItemUpdateAnimation, completion: @escaping (ListViewItemNodeLayout, @escaping () -> Void) -> Void) { + func updateNode(async: @escaping (@escaping () -> Void) -> Void, node: @escaping () -> ListViewItemNode, params: ListViewItemLayoutParams, previousItem: ListViewItem?, nextItem: ListViewItem?, animation: ListViewItemUpdateAnimation, completion: @escaping (ListViewItemNodeLayout, @escaping (ListViewItemApply) -> Void) -> Void) { Queue.mainQueue().async { if let nodeValue = node() as? ThemeSettingsFontSizeItemNode { let makeLayout = nodeValue.asyncLayout() @@ -43,7 +43,7 @@ class ThemeSettingsFontSizeItem: ListViewItem, ItemListItem { async { let (layout, apply) = makeLayout(self, params, itemListNeighbors(item: self, topItem: previousItem as? ItemListItem, bottomItem: nextItem as? ItemListItem)) Queue.mainQueue().async { - completion(layout, { + completion(layout, { _ in apply() }) } diff --git a/TelegramUI/TransformImageNode.swift b/TelegramUI/TransformImageNode.swift index 122ae2b5f4..a4f5623705 100644 --- a/TelegramUI/TransformImageNode.swift +++ b/TelegramUI/TransformImageNode.swift @@ -50,9 +50,8 @@ public class TransformImageNode: ASDisplayNode { public func setSignal(_ signal: Signal<(TransformImageArguments) -> DrawingContext?, NoError>, attemptSynchronously: Bool = false, dispatchOnDisplayLink: Bool = true) { let argumentsPromise = self.argumentsPromise - var shouldAttemptSynchronously = attemptSynchronously - let result = combineLatest(signal, argumentsPromise.get()) - |> mapToSignal { transform, arguments -> Signal<((TransformImageArguments) -> DrawingContext?, TransformImageArguments), NoError> in + let data = combineLatest(signal, argumentsPromise.get()) + /*|> mapToSignal { transform, arguments -> Signal<((TransformImageArguments) -> DrawingContext?, TransformImageArguments), NoError> in let result: Signal<((TransformImageArguments) -> DrawingContext?, TransformImageArguments), NoError> = .single((transform, arguments)) if shouldAttemptSynchronously { shouldAttemptSynchronously = false @@ -61,7 +60,17 @@ public class TransformImageNode: ASDisplayNode { return result |> deliverOn(Queue.concurrentDefaultQueue()) } + }*/ + + let resultData: Signal<((TransformImageArguments) -> DrawingContext?, TransformImageArguments), NoError> + if attemptSynchronously { + resultData = data + } else { + resultData = data + |> deliverOn(Queue.concurrentDefaultQueue()) } + + let result = resultData |> mapToThrottled { transform, arguments -> Signal<((TransformImageArguments) -> DrawingContext?, TransformImageArguments, UIImage?)?, NoError> in return deferred { if let context = transform(arguments) { @@ -102,7 +111,7 @@ public class TransformImageNode: ASDisplayNode { } } } - if dispatchOnDisplayLink { + if dispatchOnDisplayLink && !attemptSynchronously { displayLinkDispatcher.dispatch { apply() } diff --git a/TelegramUI/TransformOutgoingMessageMedia.swift b/TelegramUI/TransformOutgoingMessageMedia.swift index 2a04df07a1..65030bd10d 100644 --- a/TelegramUI/TransformOutgoingMessageMedia.swift +++ b/TelegramUI/TransformOutgoingMessageMedia.swift @@ -46,6 +46,13 @@ public func transformOutgoingMessageMedia(postbox: Postbox, network: Network, me context.setBlendMode(.copy) drawImage(context: context, image: image.cgImage!, orientation: image.imageOrientation, in: CGRect(origin: CGPoint(), size: size)) }, scale: 1.0), let thumbnailData = UIImageJPEGRepresentation(scaledImage, 0.6) { + /*if #available(iOSApplicationExtension 11.0, *) { + #if DEBUG + if true, let heicData = compressImage(scaledImage, quality: 0.7) { + print("data \(thumbnailData.count), heicData \(heicData.count)") + } + #endif + }*/ let imageDimensions = CGSize(width: image.size.width * image.scale, height: image.size.height * image.scale) let thumbnailResource = LocalFileMediaResource(fileId: arc4random64()) diff --git a/TelegramUI/UniversalVideoGalleryItem.swift b/TelegramUI/UniversalVideoGalleryItem.swift index b6ac91c230..09a0a67cf0 100644 --- a/TelegramUI/UniversalVideoGalleryItem.swift +++ b/TelegramUI/UniversalVideoGalleryItem.swift @@ -426,7 +426,7 @@ final class UniversalVideoGalleryItemNode: ZoomableContentGalleryItemNode { strongSelf.fetchStatus = fetchStatus if !item.hideControls { - strongSelf.statusButtonNode.isHidden = !initialBuffering && (strongSelf.didPause || !isPaused || value == nil) && !fetching + strongSelf.statusButtonNode.isHidden = !initialBuffering && (strongSelf.didPause || !isPaused) && !fetching } if isAnimated || disablePlayerControls { diff --git a/TelegramUI/UrlHandling.swift b/TelegramUI/UrlHandling.swift index 30b3d2df82..be3881d21b 100644 --- a/TelegramUI/UrlHandling.swift +++ b/TelegramUI/UrlHandling.swift @@ -18,6 +18,8 @@ enum ParsedInternalUrl { case proxy(host: String, port: Int32, username: String?, password: String?, secret: Data?) case internalInstantView(url: String) case confirmationCode(Int) + case cancelAccountReset(phone: String, hash: String) + case share(url: String, text: String?) } private enum ParsedUrl { @@ -37,6 +39,8 @@ enum ResolvedUrl { case join(String) case localization(String) case confirmationCode(Int) + case cancelAccountReset(phone: String, hash: String) + case share(url: String, text: String?) } func parseInternalUrl(query: String) -> ParsedInternalUrl? { @@ -103,6 +107,21 @@ func parseInternalUrl(query: String) -> ParsedInternalUrl? { if let code = code, let codeValue = Int(code) { return .confirmationCode(codeValue) } + } else if peerName == "confirmphone" { + var phone: String? + var hash: String? + for queryItem in queryItems { + if let value = queryItem.value { + if queryItem.name == "phone" { + phone = value + } else if queryItem.name == "hash" { + hash = value + } + } + } + if let phone = phone, let hash = hash { + return .cancelAccountReset(phone: phone, hash: hash) + } } else { for queryItem in queryItems { if let value = queryItem.value { @@ -129,6 +148,25 @@ func parseInternalUrl(query: String) -> ParsedInternalUrl? { if let code = Int(pathComponents[1]) { return .confirmationCode(code) } + } else if pathComponents[0] == "share" && pathComponents[1] == "url" { + if let queryItems = components.queryItems { + var url: String? + var text: String? + for queryItem in queryItems { + if let value = queryItem.value { + if queryItem.name == "url" { + url = value + } else if queryItem.name == "text" { + text = value + } + } + } + + if let url = url { + return .share(url: url, text: text) + } + } + return nil } else if let value = Int(pathComponents[1]) { return .peerName(peerName, .channelMessage(Int32(value))) } else { @@ -191,6 +229,10 @@ private func resolveInternalUrl(account: Account, url: ParsedInternalUrl) -> Sig |> map(Optional.init) case let .confirmationCode(code): return .single(.confirmationCode(code)) + case let .cancelAccountReset(phone, hash): + return .single(.cancelAccountReset(phone: phone, hash: hash)) + case let .share(url, text): + return .single(.share(url: url, text: text)) } } @@ -289,19 +331,3 @@ func resolveInstantViewUrl(account: Account, url: String) -> Signal deliverOnMainQueue).start(next: { entry in - avatarAndNameInfoContext.hiddenAvatarRepresentation = entry?.representations.first + avatarAndNameInfoContext.hiddenAvatarRepresentation = entry?.representations.first?.representation updateHiddenAvatarImpl?() })) presentControllerImpl?(galleryController, AvatarGalleryControllerPresentationArguments(transitionArguments: { entry in diff --git a/TelegramUI/UserInfoEditingPhoneActionItem.swift b/TelegramUI/UserInfoEditingPhoneActionItem.swift index cd89e7c3f7..c69fae85b8 100644 --- a/TelegramUI/UserInfoEditingPhoneActionItem.swift +++ b/TelegramUI/UserInfoEditingPhoneActionItem.swift @@ -16,7 +16,7 @@ class UserInfoEditingPhoneActionItem: ListViewItem, ItemListItem { self.action = action } - func nodeConfiguredForParams(async: @escaping (@escaping () -> Void) -> Void, params: ListViewItemLayoutParams, synchronousLoads: Bool, previousItem: ListViewItem?, nextItem: ListViewItem?, completion: @escaping (ListViewItemNode, @escaping () -> (Signal?, () -> Void)) -> Void) { + func nodeConfiguredForParams(async: @escaping (@escaping () -> Void) -> Void, params: ListViewItemLayoutParams, synchronousLoads: Bool, previousItem: ListViewItem?, nextItem: ListViewItem?, completion: @escaping (ListViewItemNode, @escaping () -> (Signal?, (ListViewItemApply) -> Void)) -> Void) { async { let node = UserInfoEditingPhoneActionItemNode() let (layout, apply) = node.asyncLayout()(self, params, itemListNeighbors(item: self, topItem: previousItem as? ItemListItem, bottomItem: nextItem as? ItemListItem)) @@ -26,13 +26,13 @@ class UserInfoEditingPhoneActionItem: ListViewItem, ItemListItem { Queue.mainQueue().async { completion(node, { - return (nil, { apply() }) + return (nil, { _ in apply() }) }) } } } - func updateNode(async: @escaping (@escaping () -> Void) -> Void, node: @escaping () -> ListViewItemNode, params: ListViewItemLayoutParams, previousItem: ListViewItem?, nextItem: ListViewItem?, animation: ListViewItemUpdateAnimation, completion: @escaping (ListViewItemNodeLayout, @escaping () -> Void) -> Void) { + func updateNode(async: @escaping (@escaping () -> Void) -> Void, node: @escaping () -> ListViewItemNode, params: ListViewItemLayoutParams, previousItem: ListViewItem?, nextItem: ListViewItem?, animation: ListViewItemUpdateAnimation, completion: @escaping (ListViewItemNodeLayout, @escaping (ListViewItemApply) -> Void) -> Void) { Queue.mainQueue().async { if let nodeValue = node() as? UserInfoEditingPhoneActionItemNode { let makeLayout = nodeValue.asyncLayout() @@ -40,7 +40,7 @@ class UserInfoEditingPhoneActionItem: ListViewItem, ItemListItem { async { let (layout, apply) = makeLayout(self, params, itemListNeighbors(item: self, topItem: previousItem as? ItemListItem, bottomItem: nextItem as? ItemListItem)) Queue.mainQueue().async { - completion(layout, { + completion(layout, { _ in apply() }) } diff --git a/TelegramUI/UserInfoEditingPhoneItem.swift b/TelegramUI/UserInfoEditingPhoneItem.swift index 679682a63e..e009335e26 100644 --- a/TelegramUI/UserInfoEditingPhoneItem.swift +++ b/TelegramUI/UserInfoEditingPhoneItem.swift @@ -37,7 +37,7 @@ class UserInfoEditingPhoneItem: ListViewItem, ItemListItem { self.tag = tag } - func nodeConfiguredForParams(async: @escaping (@escaping () -> Void) -> Void, params: ListViewItemLayoutParams, synchronousLoads: Bool, previousItem: ListViewItem?, nextItem: ListViewItem?, completion: @escaping (ListViewItemNode, @escaping () -> (Signal?, () -> Void)) -> Void) { + func nodeConfiguredForParams(async: @escaping (@escaping () -> Void) -> Void, params: ListViewItemLayoutParams, synchronousLoads: Bool, previousItem: ListViewItem?, nextItem: ListViewItem?, completion: @escaping (ListViewItemNode, @escaping () -> (Signal?, (ListViewItemApply) -> Void)) -> Void) { async { let node = UserInfoEditingPhoneItemNode() let (layout, apply) = node.asyncLayout()(self, params, itemListNeighbors(item: self, topItem: previousItem as? ItemListItem, bottomItem: nextItem as? ItemListItem)) @@ -47,13 +47,13 @@ class UserInfoEditingPhoneItem: ListViewItem, ItemListItem { Queue.mainQueue().async { completion(node, { - return (nil, { apply() }) + return (nil, { _ in apply() }) }) } } } - func updateNode(async: @escaping (@escaping () -> Void) -> Void, node: @escaping () -> ListViewItemNode, params: ListViewItemLayoutParams, previousItem: ListViewItem?, nextItem: ListViewItem?, animation: ListViewItemUpdateAnimation, completion: @escaping (ListViewItemNodeLayout, @escaping () -> Void) -> Void) { + func updateNode(async: @escaping (@escaping () -> Void) -> Void, node: @escaping () -> ListViewItemNode, params: ListViewItemLayoutParams, previousItem: ListViewItem?, nextItem: ListViewItem?, animation: ListViewItemUpdateAnimation, completion: @escaping (ListViewItemNodeLayout, @escaping (ListViewItemApply) -> Void) -> Void) { Queue.mainQueue().async { if let nodeValue = node() as? UserInfoEditingPhoneItemNode { let makeLayout = nodeValue.asyncLayout() @@ -61,7 +61,7 @@ class UserInfoEditingPhoneItem: ListViewItem, ItemListItem { async { let (layout, apply) = makeLayout(self, params, itemListNeighbors(item: self, topItem: previousItem as? ItemListItem, bottomItem: nextItem as? ItemListItem)) Queue.mainQueue().async { - completion(layout, { + completion(layout, { _ in apply() }) } diff --git a/TelegramUI/VerticalListContextResultsChatInputPanelButtonItem.swift b/TelegramUI/VerticalListContextResultsChatInputPanelButtonItem.swift index a06f354cc3..e1244121a2 100644 --- a/TelegramUI/VerticalListContextResultsChatInputPanelButtonItem.swift +++ b/TelegramUI/VerticalListContextResultsChatInputPanelButtonItem.swift @@ -16,7 +16,7 @@ final class VerticalListContextResultsChatInputPanelButtonItem: ListViewItem { self.pressed = pressed } - public func nodeConfiguredForParams(async: @escaping (@escaping () -> Void) -> Void, params: ListViewItemLayoutParams, synchronousLoads: Bool, previousItem: ListViewItem?, nextItem: ListViewItem?, completion: @escaping (ListViewItemNode, @escaping () -> (Signal?, () -> Void)) -> Void) { + public func nodeConfiguredForParams(async: @escaping (@escaping () -> Void) -> Void, params: ListViewItemLayoutParams, synchronousLoads: Bool, previousItem: ListViewItem?, nextItem: ListViewItem?, completion: @escaping (ListViewItemNode, @escaping () -> (Signal?, (ListViewItemApply) -> Void)) -> Void) { let configure = { () -> Void in let node = VerticalListContextResultsChatInputPanelButtonItemNode() @@ -29,7 +29,7 @@ final class VerticalListContextResultsChatInputPanelButtonItem: ListViewItem { Queue.mainQueue().async { completion(node, { - return (nil, { apply(.None) }) + return (nil, { _ in apply(.None) }) }) } } @@ -42,7 +42,7 @@ final class VerticalListContextResultsChatInputPanelButtonItem: ListViewItem { } } - public func updateNode(async: @escaping (@escaping () -> Void) -> Void, node: @escaping () -> ListViewItemNode, params: ListViewItemLayoutParams, previousItem: ListViewItem?, nextItem: ListViewItem?, animation: ListViewItemUpdateAnimation, completion: @escaping (ListViewItemNodeLayout, @escaping () -> Void) -> Void) { + public func updateNode(async: @escaping (@escaping () -> Void) -> Void, node: @escaping () -> ListViewItemNode, params: ListViewItemLayoutParams, previousItem: ListViewItem?, nextItem: ListViewItem?, animation: ListViewItemUpdateAnimation, completion: @escaping (ListViewItemNodeLayout, @escaping (ListViewItemApply) -> Void) -> Void) { Queue.mainQueue().async { if let nodeValue = node() as? VerticalListContextResultsChatInputPanelButtonItemNode { let nodeLayout = nodeValue.asyncLayout() @@ -52,7 +52,7 @@ final class VerticalListContextResultsChatInputPanelButtonItem: ListViewItem { let (layout, apply) = nodeLayout(self, params, top, bottom) Queue.mainQueue().async { - completion(layout, { + completion(layout, { _ in apply(animation) }) } diff --git a/TelegramUI/VerticalListContextResultsChatInputPanelItem.swift b/TelegramUI/VerticalListContextResultsChatInputPanelItem.swift index c27f10e946..3b77033124 100644 --- a/TelegramUI/VerticalListContextResultsChatInputPanelItem.swift +++ b/TelegramUI/VerticalListContextResultsChatInputPanelItem.swift @@ -20,7 +20,7 @@ final class VerticalListContextResultsChatInputPanelItem: ListViewItem { self.resultSelected = resultSelected } - public func nodeConfiguredForParams(async: @escaping (@escaping () -> Void) -> Void, params: ListViewItemLayoutParams, synchronousLoads: Bool, previousItem: ListViewItem?, nextItem: ListViewItem?, completion: @escaping (ListViewItemNode, @escaping () -> (Signal?, () -> Void)) -> Void) { + public func nodeConfiguredForParams(async: @escaping (@escaping () -> Void) -> Void, params: ListViewItemLayoutParams, synchronousLoads: Bool, previousItem: ListViewItem?, nextItem: ListViewItem?, completion: @escaping (ListViewItemNode, @escaping () -> (Signal?, (ListViewItemApply) -> Void)) -> Void) { let configure = { () -> Void in let node = VerticalListContextResultsChatInputPanelItemNode() @@ -33,7 +33,7 @@ final class VerticalListContextResultsChatInputPanelItem: ListViewItem { Queue.mainQueue().async { completion(node, { - return (nil, { apply(.None) }) + return (nil, { _ in apply(.None) }) }) } } @@ -46,7 +46,7 @@ final class VerticalListContextResultsChatInputPanelItem: ListViewItem { } } - public func updateNode(async: @escaping (@escaping () -> Void) -> Void, node: @escaping () -> ListViewItemNode, params: ListViewItemLayoutParams, previousItem: ListViewItem?, nextItem: ListViewItem?, animation: ListViewItemUpdateAnimation, completion: @escaping (ListViewItemNodeLayout, @escaping () -> Void) -> Void) { + public func updateNode(async: @escaping (@escaping () -> Void) -> Void, node: @escaping () -> ListViewItemNode, params: ListViewItemLayoutParams, previousItem: ListViewItem?, nextItem: ListViewItem?, animation: ListViewItemUpdateAnimation, completion: @escaping (ListViewItemNodeLayout, @escaping (ListViewItemApply) -> Void) -> Void) { Queue.mainQueue().async { if let nodeValue = node() as? VerticalListContextResultsChatInputPanelItemNode { let nodeLayout = nodeValue.asyncLayout() @@ -56,7 +56,7 @@ final class VerticalListContextResultsChatInputPanelItem: ListViewItem { let (layout, apply) = nodeLayout(self, params, top, bottom) Queue.mainQueue().async { - completion(layout, { + completion(layout, { _ in apply(animation) }) } diff --git a/third-party/libjpeg-turbo/jconfig.h b/third-party/libjpeg-turbo/jconfig.h new file mode 100644 index 0000000000..b62fa951cd --- /dev/null +++ b/third-party/libjpeg-turbo/jconfig.h @@ -0,0 +1,73 @@ +/* Version ID for the JPEG library. + * Might be useful for tests like "#if JPEG_LIB_VERSION >= 60". + */ +#define JPEG_LIB_VERSION 62 + +/* libjpeg-turbo version */ +#define LIBJPEG_TURBO_VERSION 2.0.1 + +/* libjpeg-turbo version in integer form */ +#define LIBJPEG_TURBO_VERSION_NUMBER 2000001 + +/* Support arithmetic encoding */ +#define C_ARITH_CODING_SUPPORTED 1 + +/* Support arithmetic decoding */ +#define D_ARITH_CODING_SUPPORTED 1 + +/* Support in-memory source/destination managers */ +#define MEM_SRCDST_SUPPORTED 1 + +/* Use accelerated SIMD routines. */ +#define WITH_SIMD 1 + +/* + * Define BITS_IN_JSAMPLE as either + * 8 for 8-bit sample values (the usual setting) + * 12 for 12-bit sample values + * Only 8 and 12 are legal data precisions for lossy JPEG according to the + * JPEG standard, and the IJG code does not support anything else! + * We do not support run-time selection of data precision, sorry. + */ + +#define BITS_IN_JSAMPLE 8 /* use 8 or 12 */ + +/* Define to 1 if you have the header file. */ +#define HAVE_LOCALE_H 1 + +/* Define to 1 if you have the header file. */ +#define HAVE_STDDEF_H 1 + +/* Define to 1 if you have the header file. */ +#define HAVE_STDLIB_H 1 + +/* Define if you need to include to get size_t. */ +#define NEED_SYS_TYPES_H 1 + +/* Define if you have BSD-like bzero and bcopy in rather than + memset/memcpy in . */ +/* #undef NEED_BSD_STRINGS */ + +/* Define to 1 if the system has the type `unsigned char'. */ +#define HAVE_UNSIGNED_CHAR 1 + +/* Define to 1 if the system has the type `unsigned short'. */ +#define HAVE_UNSIGNED_SHORT 1 + +/* Compiler does not support pointers to undefined structures. */ +/* #undef INCOMPLETE_TYPES_BROKEN */ + +/* Define if your (broken) compiler shifts signed values as if they were + unsigned. */ +/* #undef RIGHT_SHIFT_IS_UNSIGNED */ + +/* Define to 1 if type `char' is unsigned and you are not using gcc. */ +#ifndef __CHAR_UNSIGNED__ +/* #undef __CHAR_UNSIGNED__ */ +#endif + +/* Define to empty if `const' does not conform to ANSI C. */ +/* #undef const */ + +/* Define to `unsigned int' if does not define. */ +/* #undef size_t */ diff --git a/third-party/libjpeg-turbo/jerror.h b/third-party/libjpeg-turbo/jerror.h new file mode 100644 index 0000000000..933a3690fd --- /dev/null +++ b/third-party/libjpeg-turbo/jerror.h @@ -0,0 +1,316 @@ +/* + * jerror.h + * + * This file was part of the Independent JPEG Group's software: + * Copyright (C) 1994-1997, Thomas G. Lane. + * Modified 1997-2009 by Guido Vollbeding. + * libjpeg-turbo Modifications: + * Copyright (C) 2014, 2017, D. R. Commander. + * For conditions of distribution and use, see the accompanying README.ijg + * file. + * + * This file defines the error and message codes for the JPEG library. + * Edit this file to add new codes, or to translate the message strings to + * some other language. + * A set of error-reporting macros are defined too. Some applications using + * the JPEG library may wish to include this file to get the error codes + * and/or the macros. + */ + +/* + * To define the enum list of message codes, include this file without + * defining macro JMESSAGE. To create a message string table, include it + * again with a suitable JMESSAGE definition (see jerror.c for an example). + */ +#ifndef JMESSAGE +#ifndef JERROR_H +/* First time through, define the enum list */ +#define JMAKE_ENUM_LIST +#else +/* Repeated inclusions of this file are no-ops unless JMESSAGE is defined */ +#define JMESSAGE(code, string) +#endif /* JERROR_H */ +#endif /* JMESSAGE */ + +#ifdef JMAKE_ENUM_LIST + +typedef enum { + +#define JMESSAGE(code, string) code, + +#endif /* JMAKE_ENUM_LIST */ + +JMESSAGE(JMSG_NOMESSAGE, "Bogus message code %d") /* Must be first entry! */ + +/* For maintenance convenience, list is alphabetical by message code name */ +#if JPEG_LIB_VERSION < 70 +JMESSAGE(JERR_ARITH_NOTIMPL, "Sorry, arithmetic coding is not implemented") +#endif +JMESSAGE(JERR_BAD_ALIGN_TYPE, "ALIGN_TYPE is wrong, please fix") +JMESSAGE(JERR_BAD_ALLOC_CHUNK, "MAX_ALLOC_CHUNK is wrong, please fix") +JMESSAGE(JERR_BAD_BUFFER_MODE, "Bogus buffer control mode") +JMESSAGE(JERR_BAD_COMPONENT_ID, "Invalid component ID %d in SOS") +#if JPEG_LIB_VERSION >= 70 +JMESSAGE(JERR_BAD_CROP_SPEC, "Invalid crop request") +#endif +JMESSAGE(JERR_BAD_DCT_COEF, "DCT coefficient out of range") +JMESSAGE(JERR_BAD_DCTSIZE, "IDCT output block size %d not supported") +#if JPEG_LIB_VERSION >= 70 +JMESSAGE(JERR_BAD_DROP_SAMPLING, + "Component index %d: mismatching sampling ratio %d:%d, %d:%d, %c") +#endif +JMESSAGE(JERR_BAD_HUFF_TABLE, "Bogus Huffman table definition") +JMESSAGE(JERR_BAD_IN_COLORSPACE, "Bogus input colorspace") +JMESSAGE(JERR_BAD_J_COLORSPACE, "Bogus JPEG colorspace") +JMESSAGE(JERR_BAD_LENGTH, "Bogus marker length") +JMESSAGE(JERR_BAD_LIB_VERSION, + "Wrong JPEG library version: library is %d, caller expects %d") +JMESSAGE(JERR_BAD_MCU_SIZE, "Sampling factors too large for interleaved scan") +JMESSAGE(JERR_BAD_POOL_ID, "Invalid memory pool code %d") +JMESSAGE(JERR_BAD_PRECISION, "Unsupported JPEG data precision %d") +JMESSAGE(JERR_BAD_PROGRESSION, + "Invalid progressive parameters Ss=%d Se=%d Ah=%d Al=%d") +JMESSAGE(JERR_BAD_PROG_SCRIPT, + "Invalid progressive parameters at scan script entry %d") +JMESSAGE(JERR_BAD_SAMPLING, "Bogus sampling factors") +JMESSAGE(JERR_BAD_SCAN_SCRIPT, "Invalid scan script at entry %d") +JMESSAGE(JERR_BAD_STATE, "Improper call to JPEG library in state %d") +JMESSAGE(JERR_BAD_STRUCT_SIZE, + "JPEG parameter struct mismatch: library thinks size is %u, caller expects %u") +JMESSAGE(JERR_BAD_VIRTUAL_ACCESS, "Bogus virtual array access") +JMESSAGE(JERR_BUFFER_SIZE, "Buffer passed to JPEG library is too small") +JMESSAGE(JERR_CANT_SUSPEND, "Suspension not allowed here") +JMESSAGE(JERR_CCIR601_NOTIMPL, "CCIR601 sampling not implemented yet") +JMESSAGE(JERR_COMPONENT_COUNT, "Too many color components: %d, max %d") +JMESSAGE(JERR_CONVERSION_NOTIMPL, "Unsupported color conversion request") +JMESSAGE(JERR_DAC_INDEX, "Bogus DAC index %d") +JMESSAGE(JERR_DAC_VALUE, "Bogus DAC value 0x%x") +JMESSAGE(JERR_DHT_INDEX, "Bogus DHT index %d") +JMESSAGE(JERR_DQT_INDEX, "Bogus DQT index %d") +JMESSAGE(JERR_EMPTY_IMAGE, "Empty JPEG image (DNL not supported)") +JMESSAGE(JERR_EMS_READ, "Read from EMS failed") +JMESSAGE(JERR_EMS_WRITE, "Write to EMS failed") +JMESSAGE(JERR_EOI_EXPECTED, "Didn't expect more than one scan") +JMESSAGE(JERR_FILE_READ, "Input file read error") +JMESSAGE(JERR_FILE_WRITE, "Output file write error --- out of disk space?") +JMESSAGE(JERR_FRACT_SAMPLE_NOTIMPL, "Fractional sampling not implemented yet") +JMESSAGE(JERR_HUFF_CLEN_OVERFLOW, "Huffman code size table overflow") +JMESSAGE(JERR_HUFF_MISSING_CODE, "Missing Huffman code table entry") +JMESSAGE(JERR_IMAGE_TOO_BIG, "Maximum supported image dimension is %u pixels") +JMESSAGE(JERR_INPUT_EMPTY, "Empty input file") +JMESSAGE(JERR_INPUT_EOF, "Premature end of input file") +JMESSAGE(JERR_MISMATCHED_QUANT_TABLE, + "Cannot transcode due to multiple use of quantization table %d") +JMESSAGE(JERR_MISSING_DATA, "Scan script does not transmit all data") +JMESSAGE(JERR_MODE_CHANGE, "Invalid color quantization mode change") +JMESSAGE(JERR_NOTIMPL, "Not implemented yet") +JMESSAGE(JERR_NOT_COMPILED, "Requested feature was omitted at compile time") +#if JPEG_LIB_VERSION >= 70 +JMESSAGE(JERR_NO_ARITH_TABLE, "Arithmetic table 0x%02x was not defined") +#endif +JMESSAGE(JERR_NO_BACKING_STORE, "Backing store not supported") +JMESSAGE(JERR_NO_HUFF_TABLE, "Huffman table 0x%02x was not defined") +JMESSAGE(JERR_NO_IMAGE, "JPEG datastream contains no image") +JMESSAGE(JERR_NO_QUANT_TABLE, "Quantization table 0x%02x was not defined") +JMESSAGE(JERR_NO_SOI, "Not a JPEG file: starts with 0x%02x 0x%02x") +JMESSAGE(JERR_OUT_OF_MEMORY, "Insufficient memory (case %d)") +JMESSAGE(JERR_QUANT_COMPONENTS, + "Cannot quantize more than %d color components") +JMESSAGE(JERR_QUANT_FEW_COLORS, "Cannot quantize to fewer than %d colors") +JMESSAGE(JERR_QUANT_MANY_COLORS, "Cannot quantize to more than %d colors") +JMESSAGE(JERR_SOF_DUPLICATE, "Invalid JPEG file structure: two SOF markers") +JMESSAGE(JERR_SOF_NO_SOS, "Invalid JPEG file structure: missing SOS marker") +JMESSAGE(JERR_SOF_UNSUPPORTED, "Unsupported JPEG process: SOF type 0x%02x") +JMESSAGE(JERR_SOI_DUPLICATE, "Invalid JPEG file structure: two SOI markers") +JMESSAGE(JERR_SOS_NO_SOF, "Invalid JPEG file structure: SOS before SOF") +JMESSAGE(JERR_TFILE_CREATE, "Failed to create temporary file %s") +JMESSAGE(JERR_TFILE_READ, "Read failed on temporary file") +JMESSAGE(JERR_TFILE_SEEK, "Seek failed on temporary file") +JMESSAGE(JERR_TFILE_WRITE, + "Write failed on temporary file --- out of disk space?") +JMESSAGE(JERR_TOO_LITTLE_DATA, "Application transferred too few scanlines") +JMESSAGE(JERR_UNKNOWN_MARKER, "Unsupported marker type 0x%02x") +JMESSAGE(JERR_VIRTUAL_BUG, "Virtual array controller messed up") +JMESSAGE(JERR_WIDTH_OVERFLOW, "Image too wide for this implementation") +JMESSAGE(JERR_XMS_READ, "Read from XMS failed") +JMESSAGE(JERR_XMS_WRITE, "Write to XMS failed") +JMESSAGE(JMSG_COPYRIGHT, JCOPYRIGHT_SHORT) +JMESSAGE(JMSG_VERSION, JVERSION) +JMESSAGE(JTRC_16BIT_TABLES, + "Caution: quantization tables are too coarse for baseline JPEG") +JMESSAGE(JTRC_ADOBE, + "Adobe APP14 marker: version %d, flags 0x%04x 0x%04x, transform %d") +JMESSAGE(JTRC_APP0, "Unknown APP0 marker (not JFIF), length %u") +JMESSAGE(JTRC_APP14, "Unknown APP14 marker (not Adobe), length %u") +JMESSAGE(JTRC_DAC, "Define Arithmetic Table 0x%02x: 0x%02x") +JMESSAGE(JTRC_DHT, "Define Huffman Table 0x%02x") +JMESSAGE(JTRC_DQT, "Define Quantization Table %d precision %d") +JMESSAGE(JTRC_DRI, "Define Restart Interval %u") +JMESSAGE(JTRC_EMS_CLOSE, "Freed EMS handle %u") +JMESSAGE(JTRC_EMS_OPEN, "Obtained EMS handle %u") +JMESSAGE(JTRC_EOI, "End Of Image") +JMESSAGE(JTRC_HUFFBITS, " %3d %3d %3d %3d %3d %3d %3d %3d") +JMESSAGE(JTRC_JFIF, "JFIF APP0 marker: version %d.%02d, density %dx%d %d") +JMESSAGE(JTRC_JFIF_BADTHUMBNAILSIZE, + "Warning: thumbnail image size does not match data length %u") +JMESSAGE(JTRC_JFIF_EXTENSION, "JFIF extension marker: type 0x%02x, length %u") +JMESSAGE(JTRC_JFIF_THUMBNAIL, " with %d x %d thumbnail image") +JMESSAGE(JTRC_MISC_MARKER, "Miscellaneous marker 0x%02x, length %u") +JMESSAGE(JTRC_PARMLESS_MARKER, "Unexpected marker 0x%02x") +JMESSAGE(JTRC_QUANTVALS, " %4u %4u %4u %4u %4u %4u %4u %4u") +JMESSAGE(JTRC_QUANT_3_NCOLORS, "Quantizing to %d = %d*%d*%d colors") +JMESSAGE(JTRC_QUANT_NCOLORS, "Quantizing to %d colors") +JMESSAGE(JTRC_QUANT_SELECTED, "Selected %d colors for quantization") +JMESSAGE(JTRC_RECOVERY_ACTION, "At marker 0x%02x, recovery action %d") +JMESSAGE(JTRC_RST, "RST%d") +JMESSAGE(JTRC_SMOOTH_NOTIMPL, + "Smoothing not supported with nonstandard sampling ratios") +JMESSAGE(JTRC_SOF, "Start Of Frame 0x%02x: width=%u, height=%u, components=%d") +JMESSAGE(JTRC_SOF_COMPONENT, " Component %d: %dhx%dv q=%d") +JMESSAGE(JTRC_SOI, "Start of Image") +JMESSAGE(JTRC_SOS, "Start Of Scan: %d components") +JMESSAGE(JTRC_SOS_COMPONENT, " Component %d: dc=%d ac=%d") +JMESSAGE(JTRC_SOS_PARAMS, " Ss=%d, Se=%d, Ah=%d, Al=%d") +JMESSAGE(JTRC_TFILE_CLOSE, "Closed temporary file %s") +JMESSAGE(JTRC_TFILE_OPEN, "Opened temporary file %s") +JMESSAGE(JTRC_THUMB_JPEG, + "JFIF extension marker: JPEG-compressed thumbnail image, length %u") +JMESSAGE(JTRC_THUMB_PALETTE, + "JFIF extension marker: palette thumbnail image, length %u") +JMESSAGE(JTRC_THUMB_RGB, + "JFIF extension marker: RGB thumbnail image, length %u") +JMESSAGE(JTRC_UNKNOWN_IDS, + "Unrecognized component IDs %d %d %d, assuming YCbCr") +JMESSAGE(JTRC_XMS_CLOSE, "Freed XMS handle %u") +JMESSAGE(JTRC_XMS_OPEN, "Obtained XMS handle %u") +JMESSAGE(JWRN_ADOBE_XFORM, "Unknown Adobe color transform code %d") +#if JPEG_LIB_VERSION >= 70 +JMESSAGE(JWRN_ARITH_BAD_CODE, "Corrupt JPEG data: bad arithmetic code") +#endif +JMESSAGE(JWRN_BOGUS_PROGRESSION, + "Inconsistent progression sequence for component %d coefficient %d") +JMESSAGE(JWRN_EXTRANEOUS_DATA, + "Corrupt JPEG data: %u extraneous bytes before marker 0x%02x") +JMESSAGE(JWRN_HIT_MARKER, "Corrupt JPEG data: premature end of data segment") +JMESSAGE(JWRN_HUFF_BAD_CODE, "Corrupt JPEG data: bad Huffman code") +JMESSAGE(JWRN_JFIF_MAJOR, "Warning: unknown JFIF revision number %d.%02d") +JMESSAGE(JWRN_JPEG_EOF, "Premature end of JPEG file") +JMESSAGE(JWRN_MUST_RESYNC, + "Corrupt JPEG data: found marker 0x%02x instead of RST%d") +JMESSAGE(JWRN_NOT_SEQUENTIAL, "Invalid SOS parameters for sequential JPEG") +JMESSAGE(JWRN_TOO_MUCH_DATA, "Application transferred too many scanlines") +#if JPEG_LIB_VERSION < 70 +JMESSAGE(JERR_BAD_CROP_SPEC, "Invalid crop request") +#if defined(C_ARITH_CODING_SUPPORTED) || defined(D_ARITH_CODING_SUPPORTED) +JMESSAGE(JERR_NO_ARITH_TABLE, "Arithmetic table 0x%02x was not defined") +JMESSAGE(JWRN_ARITH_BAD_CODE, "Corrupt JPEG data: bad arithmetic code") +#endif +#endif +JMESSAGE(JWRN_BOGUS_ICC, "Corrupt JPEG data: bad ICC marker") + +#ifdef JMAKE_ENUM_LIST + + JMSG_LASTMSGCODE +} J_MESSAGE_CODE; + +#undef JMAKE_ENUM_LIST +#endif /* JMAKE_ENUM_LIST */ + +/* Zap JMESSAGE macro so that future re-inclusions do nothing by default */ +#undef JMESSAGE + + +#ifndef JERROR_H +#define JERROR_H + +/* Macros to simplify using the error and trace message stuff */ +/* The first parameter is either type of cinfo pointer */ + +/* Fatal errors (print message and exit) */ +#define ERREXIT(cinfo, code) \ + ((cinfo)->err->msg_code = (code), \ + (*(cinfo)->err->error_exit) ((j_common_ptr)(cinfo))) +#define ERREXIT1(cinfo, code, p1) \ + ((cinfo)->err->msg_code = (code), \ + (cinfo)->err->msg_parm.i[0] = (p1), \ + (*(cinfo)->err->error_exit) ((j_common_ptr)(cinfo))) +#define ERREXIT2(cinfo, code, p1, p2) \ + ((cinfo)->err->msg_code = (code), \ + (cinfo)->err->msg_parm.i[0] = (p1), \ + (cinfo)->err->msg_parm.i[1] = (p2), \ + (*(cinfo)->err->error_exit) ((j_common_ptr)(cinfo))) +#define ERREXIT3(cinfo, code, p1, p2, p3) \ + ((cinfo)->err->msg_code = (code), \ + (cinfo)->err->msg_parm.i[0] = (p1), \ + (cinfo)->err->msg_parm.i[1] = (p2), \ + (cinfo)->err->msg_parm.i[2] = (p3), \ + (*(cinfo)->err->error_exit) ((j_common_ptr)(cinfo))) +#define ERREXIT4(cinfo, code, p1, p2, p3, p4) \ + ((cinfo)->err->msg_code = (code), \ + (cinfo)->err->msg_parm.i[0] = (p1), \ + (cinfo)->err->msg_parm.i[1] = (p2), \ + (cinfo)->err->msg_parm.i[2] = (p3), \ + (cinfo)->err->msg_parm.i[3] = (p4), \ + (*(cinfo)->err->error_exit) ((j_common_ptr)(cinfo))) +#define ERREXITS(cinfo, code, str) \ + ((cinfo)->err->msg_code = (code), \ + strncpy((cinfo)->err->msg_parm.s, (str), JMSG_STR_PARM_MAX), \ + (*(cinfo)->err->error_exit) ((j_common_ptr)(cinfo))) + +#define MAKESTMT(stuff) do { stuff } while (0) + +/* Nonfatal errors (we can keep going, but the data is probably corrupt) */ +#define WARNMS(cinfo, code) \ + ((cinfo)->err->msg_code = (code), \ + (*(cinfo)->err->emit_message) ((j_common_ptr)(cinfo), -1)) +#define WARNMS1(cinfo, code, p1) \ + ((cinfo)->err->msg_code = (code), \ + (cinfo)->err->msg_parm.i[0] = (p1), \ + (*(cinfo)->err->emit_message) ((j_common_ptr)(cinfo), -1)) +#define WARNMS2(cinfo, code, p1, p2) \ + ((cinfo)->err->msg_code = (code), \ + (cinfo)->err->msg_parm.i[0] = (p1), \ + (cinfo)->err->msg_parm.i[1] = (p2), \ + (*(cinfo)->err->emit_message) ((j_common_ptr)(cinfo), -1)) + +/* Informational/debugging messages */ +#define TRACEMS(cinfo, lvl, code) \ + ((cinfo)->err->msg_code = (code), \ + (*(cinfo)->err->emit_message) ((j_common_ptr)(cinfo), (lvl))) +#define TRACEMS1(cinfo, lvl, code, p1) \ + ((cinfo)->err->msg_code = (code), \ + (cinfo)->err->msg_parm.i[0] = (p1), \ + (*(cinfo)->err->emit_message) ((j_common_ptr)(cinfo), (lvl))) +#define TRACEMS2(cinfo, lvl, code, p1, p2) \ + ((cinfo)->err->msg_code = (code), \ + (cinfo)->err->msg_parm.i[0] = (p1), \ + (cinfo)->err->msg_parm.i[1] = (p2), \ + (*(cinfo)->err->emit_message) ((j_common_ptr)(cinfo), (lvl))) +#define TRACEMS3(cinfo, lvl, code, p1, p2, p3) \ + MAKESTMT(int *_mp = (cinfo)->err->msg_parm.i; \ + _mp[0] = (p1); _mp[1] = (p2); _mp[2] = (p3); \ + (cinfo)->err->msg_code = (code); \ + (*(cinfo)->err->emit_message) ((j_common_ptr)(cinfo), (lvl)); ) +#define TRACEMS4(cinfo, lvl, code, p1, p2, p3, p4) \ + MAKESTMT(int *_mp = (cinfo)->err->msg_parm.i; \ + _mp[0] = (p1); _mp[1] = (p2); _mp[2] = (p3); _mp[3] = (p4); \ + (cinfo)->err->msg_code = (code); \ + (*(cinfo)->err->emit_message) ((j_common_ptr)(cinfo), (lvl)); ) +#define TRACEMS5(cinfo, lvl, code, p1, p2, p3, p4, p5) \ + MAKESTMT(int *_mp = (cinfo)->err->msg_parm.i; \ + _mp[0] = (p1); _mp[1] = (p2); _mp[2] = (p3); _mp[3] = (p4); \ + _mp[4] = (p5); \ + (cinfo)->err->msg_code = (code); \ + (*(cinfo)->err->emit_message) ((j_common_ptr)(cinfo), (lvl)); ) +#define TRACEMS8(cinfo, lvl, code, p1, p2, p3, p4, p5, p6, p7, p8) \ + MAKESTMT(int *_mp = (cinfo)->err->msg_parm.i; \ + _mp[0] = (p1); _mp[1] = (p2); _mp[2] = (p3); _mp[3] = (p4); \ + _mp[4] = (p5); _mp[5] = (p6); _mp[6] = (p7); _mp[7] = (p8); \ + (cinfo)->err->msg_code = (code); \ + (*(cinfo)->err->emit_message) ((j_common_ptr)(cinfo), (lvl)); ) +#define TRACEMSS(cinfo, lvl, code, str) \ + ((cinfo)->err->msg_code = (code), \ + strncpy((cinfo)->err->msg_parm.s, (str), JMSG_STR_PARM_MAX), \ + (*(cinfo)->err->emit_message) ((j_common_ptr)(cinfo), (lvl))) + +#endif /* JERROR_H */ diff --git a/third-party/libjpeg-turbo/jmorecfg.h b/third-party/libjpeg-turbo/jmorecfg.h new file mode 100644 index 0000000000..d0b930079a --- /dev/null +++ b/third-party/libjpeg-turbo/jmorecfg.h @@ -0,0 +1,421 @@ +/* + * jmorecfg.h + * + * This file was part of the Independent JPEG Group's software: + * Copyright (C) 1991-1997, Thomas G. Lane. + * Modified 1997-2009 by Guido Vollbeding. + * libjpeg-turbo Modifications: + * Copyright (C) 2009, 2011, 2014-2015, 2018, D. R. Commander. + * For conditions of distribution and use, see the accompanying README.ijg + * file. + * + * This file contains additional configuration options that customize the + * JPEG software for special applications or support machine-dependent + * optimizations. Most users will not need to touch this file. + */ + + +/* + * Maximum number of components (color channels) allowed in JPEG image. + * To meet the letter of Rec. ITU-T T.81 | ISO/IEC 10918-1, set this to 255. + * However, darn few applications need more than 4 channels (maybe 5 for CMYK + + * alpha mask). We recommend 10 as a reasonable compromise; use 4 if you are + * really short on memory. (Each allowed component costs a hundred or so + * bytes of storage, whether actually used in an image or not.) + */ + +#define MAX_COMPONENTS 10 /* maximum number of image components */ + + +/* + * Basic data types. + * You may need to change these if you have a machine with unusual data + * type sizes; for example, "char" not 8 bits, "short" not 16 bits, + * or "long" not 32 bits. We don't care whether "int" is 16 or 32 bits, + * but it had better be at least 16. + */ + +/* Representation of a single sample (pixel element value). + * We frequently allocate large arrays of these, so it's important to keep + * them small. But if you have memory to burn and access to char or short + * arrays is very slow on your hardware, you might want to change these. + */ + +#if BITS_IN_JSAMPLE == 8 +/* JSAMPLE should be the smallest type that will hold the values 0..255. + * You can use a signed char by having GETJSAMPLE mask it with 0xFF. + */ + +#ifdef HAVE_UNSIGNED_CHAR + +typedef unsigned char JSAMPLE; +#define GETJSAMPLE(value) ((int)(value)) + +#else /* not HAVE_UNSIGNED_CHAR */ + +typedef char JSAMPLE; +#ifdef __CHAR_UNSIGNED__ +#define GETJSAMPLE(value) ((int)(value)) +#else +#define GETJSAMPLE(value) ((int)(value) & 0xFF) +#endif /* __CHAR_UNSIGNED__ */ + +#endif /* HAVE_UNSIGNED_CHAR */ + +#define MAXJSAMPLE 255 +#define CENTERJSAMPLE 128 + +#endif /* BITS_IN_JSAMPLE == 8 */ + + +#if BITS_IN_JSAMPLE == 12 +/* JSAMPLE should be the smallest type that will hold the values 0..4095. + * On nearly all machines "short" will do nicely. + */ + +typedef short JSAMPLE; +#define GETJSAMPLE(value) ((int)(value)) + +#define MAXJSAMPLE 4095 +#define CENTERJSAMPLE 2048 + +#endif /* BITS_IN_JSAMPLE == 12 */ + + +/* Representation of a DCT frequency coefficient. + * This should be a signed value of at least 16 bits; "short" is usually OK. + * Again, we allocate large arrays of these, but you can change to int + * if you have memory to burn and "short" is really slow. + */ + +typedef short JCOEF; + + +/* Compressed datastreams are represented as arrays of JOCTET. + * These must be EXACTLY 8 bits wide, at least once they are written to + * external storage. Note that when using the stdio data source/destination + * managers, this is also the data type passed to fread/fwrite. + */ + +#ifdef HAVE_UNSIGNED_CHAR + +typedef unsigned char JOCTET; +#define GETJOCTET(value) (value) + +#else /* not HAVE_UNSIGNED_CHAR */ + +typedef char JOCTET; +#ifdef __CHAR_UNSIGNED__ +#define GETJOCTET(value) (value) +#else +#define GETJOCTET(value) ((value) & 0xFF) +#endif /* __CHAR_UNSIGNED__ */ + +#endif /* HAVE_UNSIGNED_CHAR */ + + +/* These typedefs are used for various table entries and so forth. + * They must be at least as wide as specified; but making them too big + * won't cost a huge amount of memory, so we don't provide special + * extraction code like we did for JSAMPLE. (In other words, these + * typedefs live at a different point on the speed/space tradeoff curve.) + */ + +/* UINT8 must hold at least the values 0..255. */ + +#ifdef HAVE_UNSIGNED_CHAR +typedef unsigned char UINT8; +#else /* not HAVE_UNSIGNED_CHAR */ +#ifdef __CHAR_UNSIGNED__ +typedef char UINT8; +#else /* not __CHAR_UNSIGNED__ */ +typedef short UINT8; +#endif /* __CHAR_UNSIGNED__ */ +#endif /* HAVE_UNSIGNED_CHAR */ + +/* UINT16 must hold at least the values 0..65535. */ + +#ifdef HAVE_UNSIGNED_SHORT +typedef unsigned short UINT16; +#else /* not HAVE_UNSIGNED_SHORT */ +typedef unsigned int UINT16; +#endif /* HAVE_UNSIGNED_SHORT */ + +/* INT16 must hold at least the values -32768..32767. */ + +#ifndef XMD_H /* X11/xmd.h correctly defines INT16 */ +typedef short INT16; +#endif + +/* INT32 must hold at least signed 32-bit values. + * + * NOTE: The INT32 typedef dates back to libjpeg v5 (1994.) Integers were + * sometimes 16-bit back then (MS-DOS), which is why INT32 is typedef'd to + * long. It also wasn't common (or at least as common) in 1994 for INT32 to be + * defined by platform headers. Since then, however, INT32 is defined in + * several other common places: + * + * Xmd.h (X11 header) typedefs INT32 to int on 64-bit platforms and long on + * 32-bit platforms (i.e always a 32-bit signed type.) + * + * basetsd.h (Win32 header) typedefs INT32 to int (always a 32-bit signed type + * on modern platforms.) + * + * qglobal.h (Qt header) typedefs INT32 to int (always a 32-bit signed type on + * modern platforms.) + * + * This is a recipe for conflict, since "long" and "int" aren't always + * compatible types. Since the definition of INT32 has technically been part + * of the libjpeg API for more than 20 years, we can't remove it, but we do not + * use it internally any longer. We instead define a separate type (JLONG) + * for internal use, which ensures that internal behavior will always be the + * same regardless of any external headers that may be included. + */ + +#ifndef XMD_H /* X11/xmd.h correctly defines INT32 */ +#ifndef _BASETSD_H_ /* Microsoft defines it in basetsd.h */ +#ifndef _BASETSD_H /* MinGW is slightly different */ +#ifndef QGLOBAL_H /* Qt defines it in qglobal.h */ +typedef long INT32; +#endif +#endif +#endif +#endif + +/* Datatype used for image dimensions. The JPEG standard only supports + * images up to 64K*64K due to 16-bit fields in SOF markers. Therefore + * "unsigned int" is sufficient on all machines. However, if you need to + * handle larger images and you don't mind deviating from the spec, you + * can change this datatype. (Note that changing this datatype will + * potentially require modifying the SIMD code. The x86-64 SIMD extensions, + * in particular, assume a 32-bit JDIMENSION.) + */ + +typedef unsigned int JDIMENSION; + +#define JPEG_MAX_DIMENSION 65500L /* a tad under 64K to prevent overflows */ + + +/* These macros are used in all function definitions and extern declarations. + * You could modify them if you need to change function linkage conventions; + * in particular, you'll need to do that to make the library a Windows DLL. + * Another application is to make all functions global for use with debuggers + * or code profilers that require it. + */ + +/* a function called through method pointers: */ +#define METHODDEF(type) static type +/* a function used only in its module: */ +#define LOCAL(type) static type +/* a function referenced thru EXTERNs: */ +#define GLOBAL(type) type +/* a reference to a GLOBAL function: */ +#define EXTERN(type) extern type + + +/* Originally, this macro was used as a way of defining function prototypes + * for both modern compilers as well as older compilers that did not support + * prototype parameters. libjpeg-turbo has never supported these older, + * non-ANSI compilers, but the macro is still included because there is some + * software out there that uses it. + */ + +#define JMETHOD(type, methodname, arglist) type (*methodname) arglist + + +/* libjpeg-turbo no longer supports platforms that have far symbols (MS-DOS), + * but again, some software relies on this macro. + */ + +#undef FAR +#define FAR + + +/* + * On a few systems, type boolean and/or its values FALSE, TRUE may appear + * in standard header files. Or you may have conflicts with application- + * specific header files that you want to include together with these files. + * Defining HAVE_BOOLEAN before including jpeglib.h should make it work. + */ + +#ifndef HAVE_BOOLEAN +typedef int boolean; +#endif +#ifndef FALSE /* in case these macros already exist */ +#define FALSE 0 /* values of boolean */ +#endif +#ifndef TRUE +#define TRUE 1 +#endif + + +/* + * The remaining options affect code selection within the JPEG library, + * but they don't need to be visible to most applications using the library. + * To minimize application namespace pollution, the symbols won't be + * defined unless JPEG_INTERNALS or JPEG_INTERNAL_OPTIONS has been defined. + */ + +#ifdef JPEG_INTERNALS +#define JPEG_INTERNAL_OPTIONS +#endif + +#ifdef JPEG_INTERNAL_OPTIONS + + +/* + * These defines indicate whether to include various optional functions. + * Undefining some of these symbols will produce a smaller but less capable + * library. Note that you can leave certain source files out of the + * compilation/linking process if you've #undef'd the corresponding symbols. + * (You may HAVE to do that if your compiler doesn't like null source files.) + */ + +/* Capability options common to encoder and decoder: */ + +#define DCT_ISLOW_SUPPORTED /* slow but accurate integer algorithm */ +#define DCT_IFAST_SUPPORTED /* faster, less accurate integer method */ +#define DCT_FLOAT_SUPPORTED /* floating-point: accurate, fast on fast HW */ + +/* Encoder capability options: */ + +#define C_MULTISCAN_FILES_SUPPORTED /* Multiple-scan JPEG files? */ +#define C_PROGRESSIVE_SUPPORTED /* Progressive JPEG? (Requires MULTISCAN)*/ +#define ENTROPY_OPT_SUPPORTED /* Optimization of entropy coding parms? */ +/* Note: if you selected 12-bit data precision, it is dangerous to turn off + * ENTROPY_OPT_SUPPORTED. The standard Huffman tables are only good for 8-bit + * precision, so jchuff.c normally uses entropy optimization to compute + * usable tables for higher precision. If you don't want to do optimization, + * you'll have to supply different default Huffman tables. + * The exact same statements apply for progressive JPEG: the default tables + * don't work for progressive mode. (This may get fixed, however.) + */ +#define INPUT_SMOOTHING_SUPPORTED /* Input image smoothing option? */ + +/* Decoder capability options: */ + +#define D_MULTISCAN_FILES_SUPPORTED /* Multiple-scan JPEG files? */ +#define D_PROGRESSIVE_SUPPORTED /* Progressive JPEG? (Requires MULTISCAN)*/ +#define SAVE_MARKERS_SUPPORTED /* jpeg_save_markers() needed? */ +#define BLOCK_SMOOTHING_SUPPORTED /* Block smoothing? (Progressive only) */ +#define IDCT_SCALING_SUPPORTED /* Output rescaling via IDCT? */ +#undef UPSAMPLE_SCALING_SUPPORTED /* Output rescaling at upsample stage? */ +#define UPSAMPLE_MERGING_SUPPORTED /* Fast path for sloppy upsampling? */ +#define QUANT_1PASS_SUPPORTED /* 1-pass color quantization? */ +#define QUANT_2PASS_SUPPORTED /* 2-pass color quantization? */ + +/* more capability options later, no doubt */ + + +/* + * The RGB_RED, RGB_GREEN, RGB_BLUE, and RGB_PIXELSIZE macros are a vestigial + * feature of libjpeg. The idea was that, if an application developer needed + * to compress from/decompress to a BGR/BGRX/RGBX/XBGR/XRGB buffer, they could + * change these macros, rebuild libjpeg, and link their application statically + * with it. In reality, few people ever did this, because there were some + * severe restrictions involved (cjpeg and djpeg no longer worked properly, + * compressing/decompressing RGB JPEGs no longer worked properly, and the color + * quantizer wouldn't work with pixel sizes other than 3.) Furthermore, since + * all of the O/S-supplied versions of libjpeg were built with the default + * values of RGB_RED, RGB_GREEN, RGB_BLUE, and RGB_PIXELSIZE, many applications + * have come to regard these values as immutable. + * + * The libjpeg-turbo colorspace extensions provide a much cleaner way of + * compressing from/decompressing to buffers with arbitrary component orders + * and pixel sizes. Thus, we do not support changing the values of RGB_RED, + * RGB_GREEN, RGB_BLUE, or RGB_PIXELSIZE. In addition to the restrictions + * listed above, changing these values will also break the SIMD extensions and + * the regression tests. + */ + +#define RGB_RED 0 /* Offset of Red in an RGB scanline element */ +#define RGB_GREEN 1 /* Offset of Green */ +#define RGB_BLUE 2 /* Offset of Blue */ +#define RGB_PIXELSIZE 3 /* JSAMPLEs per RGB scanline element */ + +#define JPEG_NUMCS 17 + +#define EXT_RGB_RED 0 +#define EXT_RGB_GREEN 1 +#define EXT_RGB_BLUE 2 +#define EXT_RGB_PIXELSIZE 3 + +#define EXT_RGBX_RED 0 +#define EXT_RGBX_GREEN 1 +#define EXT_RGBX_BLUE 2 +#define EXT_RGBX_PIXELSIZE 4 + +#define EXT_BGR_RED 2 +#define EXT_BGR_GREEN 1 +#define EXT_BGR_BLUE 0 +#define EXT_BGR_PIXELSIZE 3 + +#define EXT_BGRX_RED 2 +#define EXT_BGRX_GREEN 1 +#define EXT_BGRX_BLUE 0 +#define EXT_BGRX_PIXELSIZE 4 + +#define EXT_XBGR_RED 3 +#define EXT_XBGR_GREEN 2 +#define EXT_XBGR_BLUE 1 +#define EXT_XBGR_PIXELSIZE 4 + +#define EXT_XRGB_RED 1 +#define EXT_XRGB_GREEN 2 +#define EXT_XRGB_BLUE 3 +#define EXT_XRGB_PIXELSIZE 4 + +static const int rgb_red[JPEG_NUMCS] = { + -1, -1, RGB_RED, -1, -1, -1, EXT_RGB_RED, EXT_RGBX_RED, + EXT_BGR_RED, EXT_BGRX_RED, EXT_XBGR_RED, EXT_XRGB_RED, + EXT_RGBX_RED, EXT_BGRX_RED, EXT_XBGR_RED, EXT_XRGB_RED, + -1 +}; + +static const int rgb_green[JPEG_NUMCS] = { + -1, -1, RGB_GREEN, -1, -1, -1, EXT_RGB_GREEN, EXT_RGBX_GREEN, + EXT_BGR_GREEN, EXT_BGRX_GREEN, EXT_XBGR_GREEN, EXT_XRGB_GREEN, + EXT_RGBX_GREEN, EXT_BGRX_GREEN, EXT_XBGR_GREEN, EXT_XRGB_GREEN, + -1 +}; + +static const int rgb_blue[JPEG_NUMCS] = { + -1, -1, RGB_BLUE, -1, -1, -1, EXT_RGB_BLUE, EXT_RGBX_BLUE, + EXT_BGR_BLUE, EXT_BGRX_BLUE, EXT_XBGR_BLUE, EXT_XRGB_BLUE, + EXT_RGBX_BLUE, EXT_BGRX_BLUE, EXT_XBGR_BLUE, EXT_XRGB_BLUE, + -1 +}; + +static const int rgb_pixelsize[JPEG_NUMCS] = { + -1, -1, RGB_PIXELSIZE, -1, -1, -1, EXT_RGB_PIXELSIZE, EXT_RGBX_PIXELSIZE, + EXT_BGR_PIXELSIZE, EXT_BGRX_PIXELSIZE, EXT_XBGR_PIXELSIZE, EXT_XRGB_PIXELSIZE, + EXT_RGBX_PIXELSIZE, EXT_BGRX_PIXELSIZE, EXT_XBGR_PIXELSIZE, EXT_XRGB_PIXELSIZE, + -1 +}; + +/* Definitions for speed-related optimizations. */ + +/* On some machines (notably 68000 series) "int" is 32 bits, but multiplying + * two 16-bit shorts is faster than multiplying two ints. Define MULTIPLIER + * as short on such a machine. MULTIPLIER must be at least 16 bits wide. + */ + +#ifndef MULTIPLIER +#ifndef WITH_SIMD +#define MULTIPLIER int /* type for fastest integer multiply */ +#else +#define MULTIPLIER short /* prefer 16-bit with SIMD for parellelism */ +#endif +#endif + + +/* FAST_FLOAT should be either float or double, whichever is done faster + * by your compiler. (Note that this type is only used in the floating point + * DCT routines, so it only matters if you've defined DCT_FLOAT_SUPPORTED.) + */ + +#ifndef FAST_FLOAT +#define FAST_FLOAT float +#endif + +#endif /* JPEG_INTERNAL_OPTIONS */ diff --git a/third-party/libjpeg-turbo/jpeglib.h b/third-party/libjpeg-turbo/jpeglib.h new file mode 100644 index 0000000000..33f8ad2791 --- /dev/null +++ b/third-party/libjpeg-turbo/jpeglib.h @@ -0,0 +1,1132 @@ +/* + * jpeglib.h + * + * This file was part of the Independent JPEG Group's software: + * Copyright (C) 1991-1998, Thomas G. Lane. + * Modified 2002-2009 by Guido Vollbeding. + * libjpeg-turbo Modifications: + * Copyright (C) 2009-2011, 2013-2014, 2016-2017, D. R. Commander. + * Copyright (C) 2015, Google, Inc. + * For conditions of distribution and use, see the accompanying README.ijg + * file. + * + * This file defines the application interface for the JPEG library. + * Most applications using the library need only include this file, + * and perhaps jerror.h if they want to know the exact error codes. + */ + +#ifndef JPEGLIB_H +#define JPEGLIB_H + +/* + * First we include the configuration files that record how this + * installation of the JPEG library is set up. jconfig.h can be + * generated automatically for many systems. jmorecfg.h contains + * manual configuration options that most people need not worry about. + */ + +#ifndef JCONFIG_INCLUDED /* in case jinclude.h already did */ +#include "jconfig.h" /* widely used configuration options */ +#endif +#include "jmorecfg.h" /* seldom changed options */ + + +#ifdef __cplusplus +#ifndef DONT_USE_EXTERN_C +extern "C" { +#endif +#endif + + +/* Various constants determining the sizes of things. + * All of these are specified by the JPEG standard, so don't change them + * if you want to be compatible. + */ + +#define DCTSIZE 8 /* The basic DCT block is 8x8 samples */ +#define DCTSIZE2 64 /* DCTSIZE squared; # of elements in a block */ +#define NUM_QUANT_TBLS 4 /* Quantization tables are numbered 0..3 */ +#define NUM_HUFF_TBLS 4 /* Huffman tables are numbered 0..3 */ +#define NUM_ARITH_TBLS 16 /* Arith-coding tables are numbered 0..15 */ +#define MAX_COMPS_IN_SCAN 4 /* JPEG limit on # of components in one scan */ +#define MAX_SAMP_FACTOR 4 /* JPEG limit on sampling factors */ +/* Unfortunately, some bozo at Adobe saw no reason to be bound by the standard; + * the PostScript DCT filter can emit files with many more than 10 blocks/MCU. + * If you happen to run across such a file, you can up D_MAX_BLOCKS_IN_MCU + * to handle it. We even let you do this from the jconfig.h file. However, + * we strongly discourage changing C_MAX_BLOCKS_IN_MCU; just because Adobe + * sometimes emits noncompliant files doesn't mean you should too. + */ +#define C_MAX_BLOCKS_IN_MCU 10 /* compressor's limit on blocks per MCU */ +#ifndef D_MAX_BLOCKS_IN_MCU +#define D_MAX_BLOCKS_IN_MCU 10 /* decompressor's limit on blocks per MCU */ +#endif + + +/* Data structures for images (arrays of samples and of DCT coefficients). + */ + +typedef JSAMPLE *JSAMPROW; /* ptr to one image row of pixel samples. */ +typedef JSAMPROW *JSAMPARRAY; /* ptr to some rows (a 2-D sample array) */ +typedef JSAMPARRAY *JSAMPIMAGE; /* a 3-D sample array: top index is color */ + +typedef JCOEF JBLOCK[DCTSIZE2]; /* one block of coefficients */ +typedef JBLOCK *JBLOCKROW; /* pointer to one row of coefficient blocks */ +typedef JBLOCKROW *JBLOCKARRAY; /* a 2-D array of coefficient blocks */ +typedef JBLOCKARRAY *JBLOCKIMAGE; /* a 3-D array of coefficient blocks */ + +typedef JCOEF *JCOEFPTR; /* useful in a couple of places */ + + +/* Types for JPEG compression parameters and working tables. */ + + +/* DCT coefficient quantization tables. */ + +typedef struct { + /* This array gives the coefficient quantizers in natural array order + * (not the zigzag order in which they are stored in a JPEG DQT marker). + * CAUTION: IJG versions prior to v6a kept this array in zigzag order. + */ + UINT16 quantval[DCTSIZE2]; /* quantization step for each coefficient */ + /* This field is used only during compression. It's initialized FALSE when + * the table is created, and set TRUE when it's been output to the file. + * You could suppress output of a table by setting this to TRUE. + * (See jpeg_suppress_tables for an example.) + */ + boolean sent_table; /* TRUE when table has been output */ +} JQUANT_TBL; + + +/* Huffman coding tables. */ + +typedef struct { + /* These two fields directly represent the contents of a JPEG DHT marker */ + UINT8 bits[17]; /* bits[k] = # of symbols with codes of */ + /* length k bits; bits[0] is unused */ + UINT8 huffval[256]; /* The symbols, in order of incr code length */ + /* This field is used only during compression. It's initialized FALSE when + * the table is created, and set TRUE when it's been output to the file. + * You could suppress output of a table by setting this to TRUE. + * (See jpeg_suppress_tables for an example.) + */ + boolean sent_table; /* TRUE when table has been output */ +} JHUFF_TBL; + + +/* Basic info about one component (color channel). */ + +typedef struct { + /* These values are fixed over the whole image. */ + /* For compression, they must be supplied by parameter setup; */ + /* for decompression, they are read from the SOF marker. */ + int component_id; /* identifier for this component (0..255) */ + int component_index; /* its index in SOF or cinfo->comp_info[] */ + int h_samp_factor; /* horizontal sampling factor (1..4) */ + int v_samp_factor; /* vertical sampling factor (1..4) */ + int quant_tbl_no; /* quantization table selector (0..3) */ + /* These values may vary between scans. */ + /* For compression, they must be supplied by parameter setup; */ + /* for decompression, they are read from the SOS marker. */ + /* The decompressor output side may not use these variables. */ + int dc_tbl_no; /* DC entropy table selector (0..3) */ + int ac_tbl_no; /* AC entropy table selector (0..3) */ + + /* Remaining fields should be treated as private by applications. */ + + /* These values are computed during compression or decompression startup: */ + /* Component's size in DCT blocks. + * Any dummy blocks added to complete an MCU are not counted; therefore + * these values do not depend on whether a scan is interleaved or not. + */ + JDIMENSION width_in_blocks; + JDIMENSION height_in_blocks; + /* Size of a DCT block in samples. Always DCTSIZE for compression. + * For decompression this is the size of the output from one DCT block, + * reflecting any scaling we choose to apply during the IDCT step. + * Values from 1 to 16 are supported. + * Note that different components may receive different IDCT scalings. + */ +#if JPEG_LIB_VERSION >= 70 + int DCT_h_scaled_size; + int DCT_v_scaled_size; +#else + int DCT_scaled_size; +#endif + /* The downsampled dimensions are the component's actual, unpadded number + * of samples at the main buffer (preprocessing/compression interface), thus + * downsampled_width = ceil(image_width * Hi/Hmax) + * and similarly for height. For decompression, IDCT scaling is included, so + * downsampled_width = ceil(image_width * Hi/Hmax * DCT_[h_]scaled_size/DCTSIZE) + */ + JDIMENSION downsampled_width; /* actual width in samples */ + JDIMENSION downsampled_height; /* actual height in samples */ + /* This flag is used only for decompression. In cases where some of the + * components will be ignored (eg grayscale output from YCbCr image), + * we can skip most computations for the unused components. + */ + boolean component_needed; /* do we need the value of this component? */ + + /* These values are computed before starting a scan of the component. */ + /* The decompressor output side may not use these variables. */ + int MCU_width; /* number of blocks per MCU, horizontally */ + int MCU_height; /* number of blocks per MCU, vertically */ + int MCU_blocks; /* MCU_width * MCU_height */ + int MCU_sample_width; /* MCU width in samples, MCU_width*DCT_[h_]scaled_size */ + int last_col_width; /* # of non-dummy blocks across in last MCU */ + int last_row_height; /* # of non-dummy blocks down in last MCU */ + + /* Saved quantization table for component; NULL if none yet saved. + * See jdinput.c comments about the need for this information. + * This field is currently used only for decompression. + */ + JQUANT_TBL *quant_table; + + /* Private per-component storage for DCT or IDCT subsystem. */ + void *dct_table; +} jpeg_component_info; + + +/* The script for encoding a multiple-scan file is an array of these: */ + +typedef struct { + int comps_in_scan; /* number of components encoded in this scan */ + int component_index[MAX_COMPS_IN_SCAN]; /* their SOF/comp_info[] indexes */ + int Ss, Se; /* progressive JPEG spectral selection parms */ + int Ah, Al; /* progressive JPEG successive approx. parms */ +} jpeg_scan_info; + +/* The decompressor can save APPn and COM markers in a list of these: */ + +typedef struct jpeg_marker_struct *jpeg_saved_marker_ptr; + +struct jpeg_marker_struct { + jpeg_saved_marker_ptr next; /* next in list, or NULL */ + UINT8 marker; /* marker code: JPEG_COM, or JPEG_APP0+n */ + unsigned int original_length; /* # bytes of data in the file */ + unsigned int data_length; /* # bytes of data saved at data[] */ + JOCTET *data; /* the data contained in the marker */ + /* the marker length word is not counted in data_length or original_length */ +}; + +/* Known color spaces. */ + +#define JCS_EXTENSIONS 1 +#define JCS_ALPHA_EXTENSIONS 1 + +typedef enum { + JCS_UNKNOWN, /* error/unspecified */ + JCS_GRAYSCALE, /* monochrome */ + JCS_RGB, /* red/green/blue as specified by the RGB_RED, + RGB_GREEN, RGB_BLUE, and RGB_PIXELSIZE macros */ + JCS_YCbCr, /* Y/Cb/Cr (also known as YUV) */ + JCS_CMYK, /* C/M/Y/K */ + JCS_YCCK, /* Y/Cb/Cr/K */ + JCS_EXT_RGB, /* red/green/blue */ + JCS_EXT_RGBX, /* red/green/blue/x */ + JCS_EXT_BGR, /* blue/green/red */ + JCS_EXT_BGRX, /* blue/green/red/x */ + JCS_EXT_XBGR, /* x/blue/green/red */ + JCS_EXT_XRGB, /* x/red/green/blue */ + /* When out_color_space it set to JCS_EXT_RGBX, JCS_EXT_BGRX, JCS_EXT_XBGR, + or JCS_EXT_XRGB during decompression, the X byte is undefined, and in + order to ensure the best performance, libjpeg-turbo can set that byte to + whatever value it wishes. Use the following colorspace constants to + ensure that the X byte is set to 0xFF, so that it can be interpreted as an + opaque alpha channel. */ + JCS_EXT_RGBA, /* red/green/blue/alpha */ + JCS_EXT_BGRA, /* blue/green/red/alpha */ + JCS_EXT_ABGR, /* alpha/blue/green/red */ + JCS_EXT_ARGB, /* alpha/red/green/blue */ + JCS_RGB565 /* 5-bit red/6-bit green/5-bit blue */ +} J_COLOR_SPACE; + +/* DCT/IDCT algorithm options. */ + +typedef enum { + JDCT_ISLOW, /* slow but accurate integer algorithm */ + JDCT_IFAST, /* faster, less accurate integer method */ + JDCT_FLOAT /* floating-point: accurate, fast on fast HW */ +} J_DCT_METHOD; + +#ifndef JDCT_DEFAULT /* may be overridden in jconfig.h */ +#define JDCT_DEFAULT JDCT_ISLOW +#endif +#ifndef JDCT_FASTEST /* may be overridden in jconfig.h */ +#define JDCT_FASTEST JDCT_IFAST +#endif + +/* Dithering options for decompression. */ + +typedef enum { + JDITHER_NONE, /* no dithering */ + JDITHER_ORDERED, /* simple ordered dither */ + JDITHER_FS /* Floyd-Steinberg error diffusion dither */ +} J_DITHER_MODE; + + +/* Common fields between JPEG compression and decompression master structs. */ + +#define jpeg_common_fields \ + struct jpeg_error_mgr *err; /* Error handler module */ \ + struct jpeg_memory_mgr *mem; /* Memory manager module */ \ + struct jpeg_progress_mgr *progress; /* Progress monitor, or NULL if none */ \ + void *client_data; /* Available for use by application */ \ + boolean is_decompressor; /* So common code can tell which is which */ \ + int global_state /* For checking call sequence validity */ + +/* Routines that are to be used by both halves of the library are declared + * to receive a pointer to this structure. There are no actual instances of + * jpeg_common_struct, only of jpeg_compress_struct and jpeg_decompress_struct. + */ +struct jpeg_common_struct { + jpeg_common_fields; /* Fields common to both master struct types */ + /* Additional fields follow in an actual jpeg_compress_struct or + * jpeg_decompress_struct. All three structs must agree on these + * initial fields! (This would be a lot cleaner in C++.) + */ +}; + +typedef struct jpeg_common_struct *j_common_ptr; +typedef struct jpeg_compress_struct *j_compress_ptr; +typedef struct jpeg_decompress_struct *j_decompress_ptr; + + +/* Master record for a compression instance */ + +struct jpeg_compress_struct { + jpeg_common_fields; /* Fields shared with jpeg_decompress_struct */ + + /* Destination for compressed data */ + struct jpeg_destination_mgr *dest; + + /* Description of source image --- these fields must be filled in by + * outer application before starting compression. in_color_space must + * be correct before you can even call jpeg_set_defaults(). + */ + + JDIMENSION image_width; /* input image width */ + JDIMENSION image_height; /* input image height */ + int input_components; /* # of color components in input image */ + J_COLOR_SPACE in_color_space; /* colorspace of input image */ + + double input_gamma; /* image gamma of input image */ + + /* Compression parameters --- these fields must be set before calling + * jpeg_start_compress(). We recommend calling jpeg_set_defaults() to + * initialize everything to reasonable defaults, then changing anything + * the application specifically wants to change. That way you won't get + * burnt when new parameters are added. Also note that there are several + * helper routines to simplify changing parameters. + */ + +#if JPEG_LIB_VERSION >= 70 + unsigned int scale_num, scale_denom; /* fraction by which to scale image */ + + JDIMENSION jpeg_width; /* scaled JPEG image width */ + JDIMENSION jpeg_height; /* scaled JPEG image height */ + /* Dimensions of actual JPEG image that will be written to file, + * derived from input dimensions by scaling factors above. + * These fields are computed by jpeg_start_compress(). + * You can also use jpeg_calc_jpeg_dimensions() to determine these values + * in advance of calling jpeg_start_compress(). + */ +#endif + + int data_precision; /* bits of precision in image data */ + + int num_components; /* # of color components in JPEG image */ + J_COLOR_SPACE jpeg_color_space; /* colorspace of JPEG image */ + + jpeg_component_info *comp_info; + /* comp_info[i] describes component that appears i'th in SOF */ + + JQUANT_TBL *quant_tbl_ptrs[NUM_QUANT_TBLS]; +#if JPEG_LIB_VERSION >= 70 + int q_scale_factor[NUM_QUANT_TBLS]; +#endif + /* ptrs to coefficient quantization tables, or NULL if not defined, + * and corresponding scale factors (percentage, initialized 100). + */ + + JHUFF_TBL *dc_huff_tbl_ptrs[NUM_HUFF_TBLS]; + JHUFF_TBL *ac_huff_tbl_ptrs[NUM_HUFF_TBLS]; + /* ptrs to Huffman coding tables, or NULL if not defined */ + + UINT8 arith_dc_L[NUM_ARITH_TBLS]; /* L values for DC arith-coding tables */ + UINT8 arith_dc_U[NUM_ARITH_TBLS]; /* U values for DC arith-coding tables */ + UINT8 arith_ac_K[NUM_ARITH_TBLS]; /* Kx values for AC arith-coding tables */ + + int num_scans; /* # of entries in scan_info array */ + const jpeg_scan_info *scan_info; /* script for multi-scan file, or NULL */ + /* The default value of scan_info is NULL, which causes a single-scan + * sequential JPEG file to be emitted. To create a multi-scan file, + * set num_scans and scan_info to point to an array of scan definitions. + */ + + boolean raw_data_in; /* TRUE=caller supplies downsampled data */ + boolean arith_code; /* TRUE=arithmetic coding, FALSE=Huffman */ + boolean optimize_coding; /* TRUE=optimize entropy encoding parms */ + boolean CCIR601_sampling; /* TRUE=first samples are cosited */ +#if JPEG_LIB_VERSION >= 70 + boolean do_fancy_downsampling; /* TRUE=apply fancy downsampling */ +#endif + int smoothing_factor; /* 1..100, or 0 for no input smoothing */ + J_DCT_METHOD dct_method; /* DCT algorithm selector */ + + /* The restart interval can be specified in absolute MCUs by setting + * restart_interval, or in MCU rows by setting restart_in_rows + * (in which case the correct restart_interval will be figured + * for each scan). + */ + unsigned int restart_interval; /* MCUs per restart, or 0 for no restart */ + int restart_in_rows; /* if > 0, MCU rows per restart interval */ + + /* Parameters controlling emission of special markers. */ + + boolean write_JFIF_header; /* should a JFIF marker be written? */ + UINT8 JFIF_major_version; /* What to write for the JFIF version number */ + UINT8 JFIF_minor_version; + /* These three values are not used by the JPEG code, merely copied */ + /* into the JFIF APP0 marker. density_unit can be 0 for unknown, */ + /* 1 for dots/inch, or 2 for dots/cm. Note that the pixel aspect */ + /* ratio is defined by X_density/Y_density even when density_unit=0. */ + UINT8 density_unit; /* JFIF code for pixel size units */ + UINT16 X_density; /* Horizontal pixel density */ + UINT16 Y_density; /* Vertical pixel density */ + boolean write_Adobe_marker; /* should an Adobe marker be written? */ + + /* State variable: index of next scanline to be written to + * jpeg_write_scanlines(). Application may use this to control its + * processing loop, e.g., "while (next_scanline < image_height)". + */ + + JDIMENSION next_scanline; /* 0 .. image_height-1 */ + + /* Remaining fields are known throughout compressor, but generally + * should not be touched by a surrounding application. + */ + + /* + * These fields are computed during compression startup + */ + boolean progressive_mode; /* TRUE if scan script uses progressive mode */ + int max_h_samp_factor; /* largest h_samp_factor */ + int max_v_samp_factor; /* largest v_samp_factor */ + +#if JPEG_LIB_VERSION >= 70 + int min_DCT_h_scaled_size; /* smallest DCT_h_scaled_size of any component */ + int min_DCT_v_scaled_size; /* smallest DCT_v_scaled_size of any component */ +#endif + + JDIMENSION total_iMCU_rows; /* # of iMCU rows to be input to coef ctlr */ + /* The coefficient controller receives data in units of MCU rows as defined + * for fully interleaved scans (whether the JPEG file is interleaved or not). + * There are v_samp_factor * DCTSIZE sample rows of each component in an + * "iMCU" (interleaved MCU) row. + */ + + /* + * These fields are valid during any one scan. + * They describe the components and MCUs actually appearing in the scan. + */ + int comps_in_scan; /* # of JPEG components in this scan */ + jpeg_component_info *cur_comp_info[MAX_COMPS_IN_SCAN]; + /* *cur_comp_info[i] describes component that appears i'th in SOS */ + + JDIMENSION MCUs_per_row; /* # of MCUs across the image */ + JDIMENSION MCU_rows_in_scan; /* # of MCU rows in the image */ + + int blocks_in_MCU; /* # of DCT blocks per MCU */ + int MCU_membership[C_MAX_BLOCKS_IN_MCU]; + /* MCU_membership[i] is index in cur_comp_info of component owning */ + /* i'th block in an MCU */ + + int Ss, Se, Ah, Al; /* progressive JPEG parameters for scan */ + +#if JPEG_LIB_VERSION >= 80 + int block_size; /* the basic DCT block size: 1..16 */ + const int *natural_order; /* natural-order position array */ + int lim_Se; /* min( Se, DCTSIZE2-1 ) */ +#endif + + /* + * Links to compression subobjects (methods and private variables of modules) + */ + struct jpeg_comp_master *master; + struct jpeg_c_main_controller *main; + struct jpeg_c_prep_controller *prep; + struct jpeg_c_coef_controller *coef; + struct jpeg_marker_writer *marker; + struct jpeg_color_converter *cconvert; + struct jpeg_downsampler *downsample; + struct jpeg_forward_dct *fdct; + struct jpeg_entropy_encoder *entropy; + jpeg_scan_info *script_space; /* workspace for jpeg_simple_progression */ + int script_space_size; +}; + + +/* Master record for a decompression instance */ + +struct jpeg_decompress_struct { + jpeg_common_fields; /* Fields shared with jpeg_compress_struct */ + + /* Source of compressed data */ + struct jpeg_source_mgr *src; + + /* Basic description of image --- filled in by jpeg_read_header(). */ + /* Application may inspect these values to decide how to process image. */ + + JDIMENSION image_width; /* nominal image width (from SOF marker) */ + JDIMENSION image_height; /* nominal image height */ + int num_components; /* # of color components in JPEG image */ + J_COLOR_SPACE jpeg_color_space; /* colorspace of JPEG image */ + + /* Decompression processing parameters --- these fields must be set before + * calling jpeg_start_decompress(). Note that jpeg_read_header() initializes + * them to default values. + */ + + J_COLOR_SPACE out_color_space; /* colorspace for output */ + + unsigned int scale_num, scale_denom; /* fraction by which to scale image */ + + double output_gamma; /* image gamma wanted in output */ + + boolean buffered_image; /* TRUE=multiple output passes */ + boolean raw_data_out; /* TRUE=downsampled data wanted */ + + J_DCT_METHOD dct_method; /* IDCT algorithm selector */ + boolean do_fancy_upsampling; /* TRUE=apply fancy upsampling */ + boolean do_block_smoothing; /* TRUE=apply interblock smoothing */ + + boolean quantize_colors; /* TRUE=colormapped output wanted */ + /* the following are ignored if not quantize_colors: */ + J_DITHER_MODE dither_mode; /* type of color dithering to use */ + boolean two_pass_quantize; /* TRUE=use two-pass color quantization */ + int desired_number_of_colors; /* max # colors to use in created colormap */ + /* these are significant only in buffered-image mode: */ + boolean enable_1pass_quant; /* enable future use of 1-pass quantizer */ + boolean enable_external_quant;/* enable future use of external colormap */ + boolean enable_2pass_quant; /* enable future use of 2-pass quantizer */ + + /* Description of actual output image that will be returned to application. + * These fields are computed by jpeg_start_decompress(). + * You can also use jpeg_calc_output_dimensions() to determine these values + * in advance of calling jpeg_start_decompress(). + */ + + JDIMENSION output_width; /* scaled image width */ + JDIMENSION output_height; /* scaled image height */ + int out_color_components; /* # of color components in out_color_space */ + int output_components; /* # of color components returned */ + /* output_components is 1 (a colormap index) when quantizing colors; + * otherwise it equals out_color_components. + */ + int rec_outbuf_height; /* min recommended height of scanline buffer */ + /* If the buffer passed to jpeg_read_scanlines() is less than this many rows + * high, space and time will be wasted due to unnecessary data copying. + * Usually rec_outbuf_height will be 1 or 2, at most 4. + */ + + /* When quantizing colors, the output colormap is described by these fields. + * The application can supply a colormap by setting colormap non-NULL before + * calling jpeg_start_decompress; otherwise a colormap is created during + * jpeg_start_decompress or jpeg_start_output. + * The map has out_color_components rows and actual_number_of_colors columns. + */ + int actual_number_of_colors; /* number of entries in use */ + JSAMPARRAY colormap; /* The color map as a 2-D pixel array */ + + /* State variables: these variables indicate the progress of decompression. + * The application may examine these but must not modify them. + */ + + /* Row index of next scanline to be read from jpeg_read_scanlines(). + * Application may use this to control its processing loop, e.g., + * "while (output_scanline < output_height)". + */ + JDIMENSION output_scanline; /* 0 .. output_height-1 */ + + /* Current input scan number and number of iMCU rows completed in scan. + * These indicate the progress of the decompressor input side. + */ + int input_scan_number; /* Number of SOS markers seen so far */ + JDIMENSION input_iMCU_row; /* Number of iMCU rows completed */ + + /* The "output scan number" is the notional scan being displayed by the + * output side. The decompressor will not allow output scan/row number + * to get ahead of input scan/row, but it can fall arbitrarily far behind. + */ + int output_scan_number; /* Nominal scan number being displayed */ + JDIMENSION output_iMCU_row; /* Number of iMCU rows read */ + + /* Current progression status. coef_bits[c][i] indicates the precision + * with which component c's DCT coefficient i (in zigzag order) is known. + * It is -1 when no data has yet been received, otherwise it is the point + * transform (shift) value for the most recent scan of the coefficient + * (thus, 0 at completion of the progression). + * This pointer is NULL when reading a non-progressive file. + */ + int (*coef_bits)[DCTSIZE2]; /* -1 or current Al value for each coef */ + + /* Internal JPEG parameters --- the application usually need not look at + * these fields. Note that the decompressor output side may not use + * any parameters that can change between scans. + */ + + /* Quantization and Huffman tables are carried forward across input + * datastreams when processing abbreviated JPEG datastreams. + */ + + JQUANT_TBL *quant_tbl_ptrs[NUM_QUANT_TBLS]; + /* ptrs to coefficient quantization tables, or NULL if not defined */ + + JHUFF_TBL *dc_huff_tbl_ptrs[NUM_HUFF_TBLS]; + JHUFF_TBL *ac_huff_tbl_ptrs[NUM_HUFF_TBLS]; + /* ptrs to Huffman coding tables, or NULL if not defined */ + + /* These parameters are never carried across datastreams, since they + * are given in SOF/SOS markers or defined to be reset by SOI. + */ + + int data_precision; /* bits of precision in image data */ + + jpeg_component_info *comp_info; + /* comp_info[i] describes component that appears i'th in SOF */ + +#if JPEG_LIB_VERSION >= 80 + boolean is_baseline; /* TRUE if Baseline SOF0 encountered */ +#endif + boolean progressive_mode; /* TRUE if SOFn specifies progressive mode */ + boolean arith_code; /* TRUE=arithmetic coding, FALSE=Huffman */ + + UINT8 arith_dc_L[NUM_ARITH_TBLS]; /* L values for DC arith-coding tables */ + UINT8 arith_dc_U[NUM_ARITH_TBLS]; /* U values for DC arith-coding tables */ + UINT8 arith_ac_K[NUM_ARITH_TBLS]; /* Kx values for AC arith-coding tables */ + + unsigned int restart_interval; /* MCUs per restart interval, or 0 for no restart */ + + /* These fields record data obtained from optional markers recognized by + * the JPEG library. + */ + boolean saw_JFIF_marker; /* TRUE iff a JFIF APP0 marker was found */ + /* Data copied from JFIF marker; only valid if saw_JFIF_marker is TRUE: */ + UINT8 JFIF_major_version; /* JFIF version number */ + UINT8 JFIF_minor_version; + UINT8 density_unit; /* JFIF code for pixel size units */ + UINT16 X_density; /* Horizontal pixel density */ + UINT16 Y_density; /* Vertical pixel density */ + boolean saw_Adobe_marker; /* TRUE iff an Adobe APP14 marker was found */ + UINT8 Adobe_transform; /* Color transform code from Adobe marker */ + + boolean CCIR601_sampling; /* TRUE=first samples are cosited */ + + /* Aside from the specific data retained from APPn markers known to the + * library, the uninterpreted contents of any or all APPn and COM markers + * can be saved in a list for examination by the application. + */ + jpeg_saved_marker_ptr marker_list; /* Head of list of saved markers */ + + /* Remaining fields are known throughout decompressor, but generally + * should not be touched by a surrounding application. + */ + + /* + * These fields are computed during decompression startup + */ + int max_h_samp_factor; /* largest h_samp_factor */ + int max_v_samp_factor; /* largest v_samp_factor */ + +#if JPEG_LIB_VERSION >= 70 + int min_DCT_h_scaled_size; /* smallest DCT_h_scaled_size of any component */ + int min_DCT_v_scaled_size; /* smallest DCT_v_scaled_size of any component */ +#else + int min_DCT_scaled_size; /* smallest DCT_scaled_size of any component */ +#endif + + JDIMENSION total_iMCU_rows; /* # of iMCU rows in image */ + /* The coefficient controller's input and output progress is measured in + * units of "iMCU" (interleaved MCU) rows. These are the same as MCU rows + * in fully interleaved JPEG scans, but are used whether the scan is + * interleaved or not. We define an iMCU row as v_samp_factor DCT block + * rows of each component. Therefore, the IDCT output contains + * v_samp_factor*DCT_[v_]scaled_size sample rows of a component per iMCU row. + */ + + JSAMPLE *sample_range_limit; /* table for fast range-limiting */ + + /* + * These fields are valid during any one scan. + * They describe the components and MCUs actually appearing in the scan. + * Note that the decompressor output side must not use these fields. + */ + int comps_in_scan; /* # of JPEG components in this scan */ + jpeg_component_info *cur_comp_info[MAX_COMPS_IN_SCAN]; + /* *cur_comp_info[i] describes component that appears i'th in SOS */ + + JDIMENSION MCUs_per_row; /* # of MCUs across the image */ + JDIMENSION MCU_rows_in_scan; /* # of MCU rows in the image */ + + int blocks_in_MCU; /* # of DCT blocks per MCU */ + int MCU_membership[D_MAX_BLOCKS_IN_MCU]; + /* MCU_membership[i] is index in cur_comp_info of component owning */ + /* i'th block in an MCU */ + + int Ss, Se, Ah, Al; /* progressive JPEG parameters for scan */ + +#if JPEG_LIB_VERSION >= 80 + /* These fields are derived from Se of first SOS marker. + */ + int block_size; /* the basic DCT block size: 1..16 */ + const int *natural_order; /* natural-order position array for entropy decode */ + int lim_Se; /* min( Se, DCTSIZE2-1 ) for entropy decode */ +#endif + + /* This field is shared between entropy decoder and marker parser. + * It is either zero or the code of a JPEG marker that has been + * read from the data source, but has not yet been processed. + */ + int unread_marker; + + /* + * Links to decompression subobjects (methods, private variables of modules) + */ + struct jpeg_decomp_master *master; + struct jpeg_d_main_controller *main; + struct jpeg_d_coef_controller *coef; + struct jpeg_d_post_controller *post; + struct jpeg_input_controller *inputctl; + struct jpeg_marker_reader *marker; + struct jpeg_entropy_decoder *entropy; + struct jpeg_inverse_dct *idct; + struct jpeg_upsampler *upsample; + struct jpeg_color_deconverter *cconvert; + struct jpeg_color_quantizer *cquantize; +}; + + +/* "Object" declarations for JPEG modules that may be supplied or called + * directly by the surrounding application. + * As with all objects in the JPEG library, these structs only define the + * publicly visible methods and state variables of a module. Additional + * private fields may exist after the public ones. + */ + + +/* Error handler object */ + +struct jpeg_error_mgr { + /* Error exit handler: does not return to caller */ + void (*error_exit) (j_common_ptr cinfo); + /* Conditionally emit a trace or warning message */ + void (*emit_message) (j_common_ptr cinfo, int msg_level); + /* Routine that actually outputs a trace or error message */ + void (*output_message) (j_common_ptr cinfo); + /* Format a message string for the most recent JPEG error or message */ + void (*format_message) (j_common_ptr cinfo, char *buffer); +#define JMSG_LENGTH_MAX 200 /* recommended size of format_message buffer */ + /* Reset error state variables at start of a new image */ + void (*reset_error_mgr) (j_common_ptr cinfo); + + /* The message ID code and any parameters are saved here. + * A message can have one string parameter or up to 8 int parameters. + */ + int msg_code; +#define JMSG_STR_PARM_MAX 80 + union { + int i[8]; + char s[JMSG_STR_PARM_MAX]; + } msg_parm; + + /* Standard state variables for error facility */ + + int trace_level; /* max msg_level that will be displayed */ + + /* For recoverable corrupt-data errors, we emit a warning message, + * but keep going unless emit_message chooses to abort. emit_message + * should count warnings in num_warnings. The surrounding application + * can check for bad data by seeing if num_warnings is nonzero at the + * end of processing. + */ + long num_warnings; /* number of corrupt-data warnings */ + + /* These fields point to the table(s) of error message strings. + * An application can change the table pointer to switch to a different + * message list (typically, to change the language in which errors are + * reported). Some applications may wish to add additional error codes + * that will be handled by the JPEG library error mechanism; the second + * table pointer is used for this purpose. + * + * First table includes all errors generated by JPEG library itself. + * Error code 0 is reserved for a "no such error string" message. + */ + const char * const *jpeg_message_table; /* Library errors */ + int last_jpeg_message; /* Table contains strings 0..last_jpeg_message */ + /* Second table can be added by application (see cjpeg/djpeg for example). + * It contains strings numbered first_addon_message..last_addon_message. + */ + const char * const *addon_message_table; /* Non-library errors */ + int first_addon_message; /* code for first string in addon table */ + int last_addon_message; /* code for last string in addon table */ +}; + + +/* Progress monitor object */ + +struct jpeg_progress_mgr { + void (*progress_monitor) (j_common_ptr cinfo); + + long pass_counter; /* work units completed in this pass */ + long pass_limit; /* total number of work units in this pass */ + int completed_passes; /* passes completed so far */ + int total_passes; /* total number of passes expected */ +}; + + +/* Data destination object for compression */ + +struct jpeg_destination_mgr { + JOCTET *next_output_byte; /* => next byte to write in buffer */ + size_t free_in_buffer; /* # of byte spaces remaining in buffer */ + + void (*init_destination) (j_compress_ptr cinfo); + boolean (*empty_output_buffer) (j_compress_ptr cinfo); + void (*term_destination) (j_compress_ptr cinfo); +}; + + +/* Data source object for decompression */ + +struct jpeg_source_mgr { + const JOCTET *next_input_byte; /* => next byte to read from buffer */ + size_t bytes_in_buffer; /* # of bytes remaining in buffer */ + + void (*init_source) (j_decompress_ptr cinfo); + boolean (*fill_input_buffer) (j_decompress_ptr cinfo); + void (*skip_input_data) (j_decompress_ptr cinfo, long num_bytes); + boolean (*resync_to_restart) (j_decompress_ptr cinfo, int desired); + void (*term_source) (j_decompress_ptr cinfo); +}; + + +/* Memory manager object. + * Allocates "small" objects (a few K total), "large" objects (tens of K), + * and "really big" objects (virtual arrays with backing store if needed). + * The memory manager does not allow individual objects to be freed; rather, + * each created object is assigned to a pool, and whole pools can be freed + * at once. This is faster and more convenient than remembering exactly what + * to free, especially where malloc()/free() are not too speedy. + * NB: alloc routines never return NULL. They exit to error_exit if not + * successful. + */ + +#define JPOOL_PERMANENT 0 /* lasts until master record is destroyed */ +#define JPOOL_IMAGE 1 /* lasts until done with image/datastream */ +#define JPOOL_NUMPOOLS 2 + +typedef struct jvirt_sarray_control *jvirt_sarray_ptr; +typedef struct jvirt_barray_control *jvirt_barray_ptr; + + +struct jpeg_memory_mgr { + /* Method pointers */ + void *(*alloc_small) (j_common_ptr cinfo, int pool_id, size_t sizeofobject); + void *(*alloc_large) (j_common_ptr cinfo, int pool_id, + size_t sizeofobject); + JSAMPARRAY (*alloc_sarray) (j_common_ptr cinfo, int pool_id, + JDIMENSION samplesperrow, JDIMENSION numrows); + JBLOCKARRAY (*alloc_barray) (j_common_ptr cinfo, int pool_id, + JDIMENSION blocksperrow, JDIMENSION numrows); + jvirt_sarray_ptr (*request_virt_sarray) (j_common_ptr cinfo, int pool_id, + boolean pre_zero, + JDIMENSION samplesperrow, + JDIMENSION numrows, + JDIMENSION maxaccess); + jvirt_barray_ptr (*request_virt_barray) (j_common_ptr cinfo, int pool_id, + boolean pre_zero, + JDIMENSION blocksperrow, + JDIMENSION numrows, + JDIMENSION maxaccess); + void (*realize_virt_arrays) (j_common_ptr cinfo); + JSAMPARRAY (*access_virt_sarray) (j_common_ptr cinfo, jvirt_sarray_ptr ptr, + JDIMENSION start_row, JDIMENSION num_rows, + boolean writable); + JBLOCKARRAY (*access_virt_barray) (j_common_ptr cinfo, jvirt_barray_ptr ptr, + JDIMENSION start_row, JDIMENSION num_rows, + boolean writable); + void (*free_pool) (j_common_ptr cinfo, int pool_id); + void (*self_destruct) (j_common_ptr cinfo); + + /* Limit on memory allocation for this JPEG object. (Note that this is + * merely advisory, not a guaranteed maximum; it only affects the space + * used for virtual-array buffers.) May be changed by outer application + * after creating the JPEG object. + */ + long max_memory_to_use; + + /* Maximum allocation request accepted by alloc_large. */ + long max_alloc_chunk; +}; + + +/* Routine signature for application-supplied marker processing methods. + * Need not pass marker code since it is stored in cinfo->unread_marker. + */ +typedef boolean (*jpeg_marker_parser_method) (j_decompress_ptr cinfo); + + +/* Originally, this macro was used as a way of defining function prototypes + * for both modern compilers as well as older compilers that did not support + * prototype parameters. libjpeg-turbo has never supported these older, + * non-ANSI compilers, but the macro is still included because there is some + * software out there that uses it. + */ + +#define JPP(arglist) arglist + + +/* Default error-management setup */ +EXTERN(struct jpeg_error_mgr *) jpeg_std_error(struct jpeg_error_mgr *err); + +/* Initialization of JPEG compression objects. + * jpeg_create_compress() and jpeg_create_decompress() are the exported + * names that applications should call. These expand to calls on + * jpeg_CreateCompress and jpeg_CreateDecompress with additional information + * passed for version mismatch checking. + * NB: you must set up the error-manager BEFORE calling jpeg_create_xxx. + */ +#define jpeg_create_compress(cinfo) \ + jpeg_CreateCompress((cinfo), JPEG_LIB_VERSION, \ + (size_t)sizeof(struct jpeg_compress_struct)) +#define jpeg_create_decompress(cinfo) \ + jpeg_CreateDecompress((cinfo), JPEG_LIB_VERSION, \ + (size_t)sizeof(struct jpeg_decompress_struct)) +EXTERN(void) jpeg_CreateCompress(j_compress_ptr cinfo, int version, + size_t structsize); +EXTERN(void) jpeg_CreateDecompress(j_decompress_ptr cinfo, int version, + size_t structsize); +/* Destruction of JPEG compression objects */ +EXTERN(void) jpeg_destroy_compress(j_compress_ptr cinfo); +EXTERN(void) jpeg_destroy_decompress(j_decompress_ptr cinfo); + +/* Standard data source and destination managers: stdio streams. */ +/* Caller is responsible for opening the file before and closing after. */ +EXTERN(void) jpeg_stdio_dest(j_compress_ptr cinfo, FILE *outfile); +EXTERN(void) jpeg_stdio_src(j_decompress_ptr cinfo, FILE *infile); + +#if JPEG_LIB_VERSION >= 80 || defined(MEM_SRCDST_SUPPORTED) +/* Data source and destination managers: memory buffers. */ +EXTERN(void) jpeg_mem_dest(j_compress_ptr cinfo, unsigned char **outbuffer, + unsigned long *outsize); +EXTERN(void) jpeg_mem_src(j_decompress_ptr cinfo, + const unsigned char *inbuffer, unsigned long insize); +#endif + +/* Default parameter setup for compression */ +EXTERN(void) jpeg_set_defaults(j_compress_ptr cinfo); +/* Compression parameter setup aids */ +EXTERN(void) jpeg_set_colorspace(j_compress_ptr cinfo, + J_COLOR_SPACE colorspace); +EXTERN(void) jpeg_default_colorspace(j_compress_ptr cinfo); +EXTERN(void) jpeg_set_quality(j_compress_ptr cinfo, int quality, + boolean force_baseline); +EXTERN(void) jpeg_set_linear_quality(j_compress_ptr cinfo, int scale_factor, + boolean force_baseline); +#if JPEG_LIB_VERSION >= 70 +EXTERN(void) jpeg_default_qtables(j_compress_ptr cinfo, + boolean force_baseline); +#endif +EXTERN(void) jpeg_add_quant_table(j_compress_ptr cinfo, int which_tbl, + const unsigned int *basic_table, + int scale_factor, boolean force_baseline); +EXTERN(int) jpeg_quality_scaling(int quality); +EXTERN(void) jpeg_simple_progression(j_compress_ptr cinfo); +EXTERN(void) jpeg_suppress_tables(j_compress_ptr cinfo, boolean suppress); +EXTERN(JQUANT_TBL *) jpeg_alloc_quant_table(j_common_ptr cinfo); +EXTERN(JHUFF_TBL *) jpeg_alloc_huff_table(j_common_ptr cinfo); + +/* Main entry points for compression */ +EXTERN(void) jpeg_start_compress(j_compress_ptr cinfo, + boolean write_all_tables); +EXTERN(JDIMENSION) jpeg_write_scanlines(j_compress_ptr cinfo, + JSAMPARRAY scanlines, + JDIMENSION num_lines); +EXTERN(void) jpeg_finish_compress(j_compress_ptr cinfo); + +#if JPEG_LIB_VERSION >= 70 +/* Precalculate JPEG dimensions for current compression parameters. */ +EXTERN(void) jpeg_calc_jpeg_dimensions(j_compress_ptr cinfo); +#endif + +/* Replaces jpeg_write_scanlines when writing raw downsampled data. */ +EXTERN(JDIMENSION) jpeg_write_raw_data(j_compress_ptr cinfo, JSAMPIMAGE data, + JDIMENSION num_lines); + +/* Write a special marker. See libjpeg.txt concerning safe usage. */ +EXTERN(void) jpeg_write_marker(j_compress_ptr cinfo, int marker, + const JOCTET *dataptr, unsigned int datalen); +/* Same, but piecemeal. */ +EXTERN(void) jpeg_write_m_header(j_compress_ptr cinfo, int marker, + unsigned int datalen); +EXTERN(void) jpeg_write_m_byte(j_compress_ptr cinfo, int val); + +/* Alternate compression function: just write an abbreviated table file */ +EXTERN(void) jpeg_write_tables(j_compress_ptr cinfo); + +/* Write ICC profile. See libjpeg.txt for usage information. */ +EXTERN(void) jpeg_write_icc_profile(j_compress_ptr cinfo, + const JOCTET *icc_data_ptr, + unsigned int icc_data_len); + + +/* Decompression startup: read start of JPEG datastream to see what's there */ +EXTERN(int) jpeg_read_header(j_decompress_ptr cinfo, boolean require_image); +/* Return value is one of: */ +#define JPEG_SUSPENDED 0 /* Suspended due to lack of input data */ +#define JPEG_HEADER_OK 1 /* Found valid image datastream */ +#define JPEG_HEADER_TABLES_ONLY 2 /* Found valid table-specs-only datastream */ +/* If you pass require_image = TRUE (normal case), you need not check for + * a TABLES_ONLY return code; an abbreviated file will cause an error exit. + * JPEG_SUSPENDED is only possible if you use a data source module that can + * give a suspension return (the stdio source module doesn't). + */ + +/* Main entry points for decompression */ +EXTERN(boolean) jpeg_start_decompress(j_decompress_ptr cinfo); +EXTERN(JDIMENSION) jpeg_read_scanlines(j_decompress_ptr cinfo, + JSAMPARRAY scanlines, + JDIMENSION max_lines); +EXTERN(JDIMENSION) jpeg_skip_scanlines(j_decompress_ptr cinfo, + JDIMENSION num_lines); +EXTERN(void) jpeg_crop_scanline(j_decompress_ptr cinfo, JDIMENSION *xoffset, + JDIMENSION *width); +EXTERN(boolean) jpeg_finish_decompress(j_decompress_ptr cinfo); + +/* Replaces jpeg_read_scanlines when reading raw downsampled data. */ +EXTERN(JDIMENSION) jpeg_read_raw_data(j_decompress_ptr cinfo, JSAMPIMAGE data, + JDIMENSION max_lines); + +/* Additional entry points for buffered-image mode. */ +EXTERN(boolean) jpeg_has_multiple_scans(j_decompress_ptr cinfo); +EXTERN(boolean) jpeg_start_output(j_decompress_ptr cinfo, int scan_number); +EXTERN(boolean) jpeg_finish_output(j_decompress_ptr cinfo); +EXTERN(boolean) jpeg_input_complete(j_decompress_ptr cinfo); +EXTERN(void) jpeg_new_colormap(j_decompress_ptr cinfo); +EXTERN(int) jpeg_consume_input(j_decompress_ptr cinfo); +/* Return value is one of: */ +/* #define JPEG_SUSPENDED 0 Suspended due to lack of input data */ +#define JPEG_REACHED_SOS 1 /* Reached start of new scan */ +#define JPEG_REACHED_EOI 2 /* Reached end of image */ +#define JPEG_ROW_COMPLETED 3 /* Completed one iMCU row */ +#define JPEG_SCAN_COMPLETED 4 /* Completed last iMCU row of a scan */ + +/* Precalculate output dimensions for current decompression parameters. */ +#if JPEG_LIB_VERSION >= 80 +EXTERN(void) jpeg_core_output_dimensions(j_decompress_ptr cinfo); +#endif +EXTERN(void) jpeg_calc_output_dimensions(j_decompress_ptr cinfo); + +/* Control saving of COM and APPn markers into marker_list. */ +EXTERN(void) jpeg_save_markers(j_decompress_ptr cinfo, int marker_code, + unsigned int length_limit); + +/* Install a special processing method for COM or APPn markers. */ +EXTERN(void) jpeg_set_marker_processor(j_decompress_ptr cinfo, + int marker_code, + jpeg_marker_parser_method routine); + +/* Read or write raw DCT coefficients --- useful for lossless transcoding. */ +EXTERN(jvirt_barray_ptr *) jpeg_read_coefficients(j_decompress_ptr cinfo); +EXTERN(void) jpeg_write_coefficients(j_compress_ptr cinfo, + jvirt_barray_ptr *coef_arrays); +EXTERN(void) jpeg_copy_critical_parameters(j_decompress_ptr srcinfo, + j_compress_ptr dstinfo); + +/* If you choose to abort compression or decompression before completing + * jpeg_finish_(de)compress, then you need to clean up to release memory, + * temporary files, etc. You can just call jpeg_destroy_(de)compress + * if you're done with the JPEG object, but if you want to clean it up and + * reuse it, call this: + */ +EXTERN(void) jpeg_abort_compress(j_compress_ptr cinfo); +EXTERN(void) jpeg_abort_decompress(j_decompress_ptr cinfo); + +/* Generic versions of jpeg_abort and jpeg_destroy that work on either + * flavor of JPEG object. These may be more convenient in some places. + */ +EXTERN(void) jpeg_abort(j_common_ptr cinfo); +EXTERN(void) jpeg_destroy(j_common_ptr cinfo); + +/* Default restart-marker-resync procedure for use by data source modules */ +EXTERN(boolean) jpeg_resync_to_restart(j_decompress_ptr cinfo, int desired); + +/* Read ICC profile. See libjpeg.txt for usage information. */ +EXTERN(boolean) jpeg_read_icc_profile(j_decompress_ptr cinfo, + JOCTET **icc_data_ptr, + unsigned int *icc_data_len); + + +/* These marker codes are exported since applications and data source modules + * are likely to want to use them. + */ + +#define JPEG_RST0 0xD0 /* RST0 marker code */ +#define JPEG_EOI 0xD9 /* EOI marker code */ +#define JPEG_APP0 0xE0 /* APP0 marker code */ +#define JPEG_COM 0xFE /* COM marker code */ + + +/* If we have a brain-damaged compiler that emits warnings (or worse, errors) + * for structure definitions that are never filled in, keep it quiet by + * supplying dummy definitions for the various substructures. + */ + +#ifdef INCOMPLETE_TYPES_BROKEN +#ifndef JPEG_INTERNALS /* will be defined in jpegint.h */ +struct jvirt_sarray_control { long dummy; }; +struct jvirt_barray_control { long dummy; }; +struct jpeg_comp_master { long dummy; }; +struct jpeg_c_main_controller { long dummy; }; +struct jpeg_c_prep_controller { long dummy; }; +struct jpeg_c_coef_controller { long dummy; }; +struct jpeg_marker_writer { long dummy; }; +struct jpeg_color_converter { long dummy; }; +struct jpeg_downsampler { long dummy; }; +struct jpeg_forward_dct { long dummy; }; +struct jpeg_entropy_encoder { long dummy; }; +struct jpeg_decomp_master { long dummy; }; +struct jpeg_d_main_controller { long dummy; }; +struct jpeg_d_coef_controller { long dummy; }; +struct jpeg_d_post_controller { long dummy; }; +struct jpeg_input_controller { long dummy; }; +struct jpeg_marker_reader { long dummy; }; +struct jpeg_entropy_decoder { long dummy; }; +struct jpeg_inverse_dct { long dummy; }; +struct jpeg_upsampler { long dummy; }; +struct jpeg_color_deconverter { long dummy; }; +struct jpeg_color_quantizer { long dummy; }; +#endif /* JPEG_INTERNALS */ +#endif /* INCOMPLETE_TYPES_BROKEN */ + + +/* + * The JPEG library modules define JPEG_INTERNALS before including this file. + * The internal structure declarations are read only when that is true. + * Applications using the library should not include jpegint.h, but may wish + * to include jerror.h. + */ + +#ifdef JPEG_INTERNALS +#include "jpegint.h" /* fetch private declarations */ +#include "jerror.h" /* fetch error codes too */ +#endif + +#ifdef __cplusplus +#ifndef DONT_USE_EXTERN_C +} +#endif +#endif + +#endif /* JPEGLIB_H */ diff --git a/third-party/libjpeg-turbo/libturbojpeg.a b/third-party/libjpeg-turbo/libturbojpeg.a new file mode 100644 index 0000000000..abae1ed20e Binary files /dev/null and b/third-party/libjpeg-turbo/libturbojpeg.a differ diff --git a/third-party/libjpeg-turbo/turbojpeg.h b/third-party/libjpeg-turbo/turbojpeg.h new file mode 100644 index 0000000000..9c0a3713a5 --- /dev/null +++ b/third-party/libjpeg-turbo/turbojpeg.h @@ -0,0 +1,1744 @@ +/* + * Copyright (C)2009-2015, 2017 D. R. Commander. All Rights Reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are met: + * + * - Redistributions of source code must retain the above copyright notice, + * this list of conditions and the following disclaimer. + * - Redistributions in binary form must reproduce the above copyright notice, + * this list of conditions and the following disclaimer in the documentation + * and/or other materials provided with the distribution. + * - Neither the name of the libjpeg-turbo Project nor the names of its + * contributors may be used to endorse or promote products derived from this + * software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS", + * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDERS OR CONTRIBUTORS BE + * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR + * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF + * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS + * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN + * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) + * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE + * POSSIBILITY OF SUCH DAMAGE. + */ + +#ifndef __TURBOJPEG_H__ +#define __TURBOJPEG_H__ + +#if defined(_WIN32) && defined(DLLDEFINE) +#define DLLEXPORT __declspec(dllexport) +#else +#define DLLEXPORT +#endif +#define DLLCALL + + +/** + * @addtogroup TurboJPEG + * TurboJPEG API. This API provides an interface for generating, decoding, and + * transforming planar YUV and JPEG images in memory. + * + * @anchor YUVnotes + * YUV Image Format Notes + * ---------------------- + * Technically, the JPEG format uses the YCbCr colorspace (which is technically + * not a colorspace but a color transform), but per the convention of the + * digital video community, the TurboJPEG API uses "YUV" to refer to an image + * format consisting of Y, Cb, and Cr image planes. + * + * Each plane is simply a 2D array of bytes, each byte representing the value + * of one of the components (Y, Cb, or Cr) at a particular location in the + * image. The width and height of each plane are determined by the image + * width, height, and level of chrominance subsampling. The luminance plane + * width is the image width padded to the nearest multiple of the horizontal + * subsampling factor (2 in the case of 4:2:0 and 4:2:2, 4 in the case of + * 4:1:1, 1 in the case of 4:4:4 or grayscale.) Similarly, the luminance plane + * height is the image height padded to the nearest multiple of the vertical + * subsampling factor (2 in the case of 4:2:0 or 4:4:0, 1 in the case of 4:4:4 + * or grayscale.) This is irrespective of any additional padding that may be + * specified as an argument to the various YUV functions. The chrominance + * plane width is equal to the luminance plane width divided by the horizontal + * subsampling factor, and the chrominance plane height is equal to the + * luminance plane height divided by the vertical subsampling factor. + * + * For example, if the source image is 35 x 35 pixels and 4:2:2 subsampling is + * used, then the luminance plane would be 36 x 35 bytes, and each of the + * chrominance planes would be 18 x 35 bytes. If you specify a line padding of + * 4 bytes on top of this, then the luminance plane would be 36 x 35 bytes, and + * each of the chrominance planes would be 20 x 35 bytes. + * + * @{ + */ + + +/** + * The number of chrominance subsampling options + */ +#define TJ_NUMSAMP 6 + +/** + * Chrominance subsampling options. + * When pixels are converted from RGB to YCbCr (see #TJCS_YCbCr) or from CMYK + * to YCCK (see #TJCS_YCCK) as part of the JPEG compression process, some of + * the Cb and Cr (chrominance) components can be discarded or averaged together + * to produce a smaller image with little perceptible loss of image clarity + * (the human eye is more sensitive to small changes in brightness than to + * small changes in color.) This is called "chrominance subsampling". + */ +enum TJSAMP { + /** + * 4:4:4 chrominance subsampling (no chrominance subsampling). The JPEG or + * YUV image will contain one chrominance component for every pixel in the + * source image. + */ + TJSAMP_444 = 0, + /** + * 4:2:2 chrominance subsampling. The JPEG or YUV image will contain one + * chrominance component for every 2x1 block of pixels in the source image. + */ + TJSAMP_422, + /** + * 4:2:0 chrominance subsampling. The JPEG or YUV image will contain one + * chrominance component for every 2x2 block of pixels in the source image. + */ + TJSAMP_420, + /** + * Grayscale. The JPEG or YUV image will contain no chrominance components. + */ + TJSAMP_GRAY, + /** + * 4:4:0 chrominance subsampling. The JPEG or YUV image will contain one + * chrominance component for every 1x2 block of pixels in the source image. + * + * @note 4:4:0 subsampling is not fully accelerated in libjpeg-turbo. + */ + TJSAMP_440, + /** + * 4:1:1 chrominance subsampling. The JPEG or YUV image will contain one + * chrominance component for every 4x1 block of pixels in the source image. + * JPEG images compressed with 4:1:1 subsampling will be almost exactly the + * same size as those compressed with 4:2:0 subsampling, and in the + * aggregate, both subsampling methods produce approximately the same + * perceptual quality. However, 4:1:1 is better able to reproduce sharp + * horizontal features. + * + * @note 4:1:1 subsampling is not fully accelerated in libjpeg-turbo. + */ + TJSAMP_411 +}; + +/** + * MCU block width (in pixels) for a given level of chrominance subsampling. + * MCU block sizes: + * - 8x8 for no subsampling or grayscale + * - 16x8 for 4:2:2 + * - 8x16 for 4:4:0 + * - 16x16 for 4:2:0 + * - 32x8 for 4:1:1 + */ +static const int tjMCUWidth[TJ_NUMSAMP] = { 8, 16, 16, 8, 8, 32 }; + +/** + * MCU block height (in pixels) for a given level of chrominance subsampling. + * MCU block sizes: + * - 8x8 for no subsampling or grayscale + * - 16x8 for 4:2:2 + * - 8x16 for 4:4:0 + * - 16x16 for 4:2:0 + * - 32x8 for 4:1:1 + */ +static const int tjMCUHeight[TJ_NUMSAMP] = { 8, 8, 16, 8, 16, 8 }; + + +/** + * The number of pixel formats + */ +#define TJ_NUMPF 12 + +/** + * Pixel formats + */ +enum TJPF { + /** + * RGB pixel format. The red, green, and blue components in the image are + * stored in 3-byte pixels in the order R, G, B from lowest to highest byte + * address within each pixel. + */ + TJPF_RGB = 0, + /** + * BGR pixel format. The red, green, and blue components in the image are + * stored in 3-byte pixels in the order B, G, R from lowest to highest byte + * address within each pixel. + */ + TJPF_BGR, + /** + * RGBX pixel format. The red, green, and blue components in the image are + * stored in 4-byte pixels in the order R, G, B from lowest to highest byte + * address within each pixel. The X component is ignored when compressing + * and undefined when decompressing. + */ + TJPF_RGBX, + /** + * BGRX pixel format. The red, green, and blue components in the image are + * stored in 4-byte pixels in the order B, G, R from lowest to highest byte + * address within each pixel. The X component is ignored when compressing + * and undefined when decompressing. + */ + TJPF_BGRX, + /** + * XBGR pixel format. The red, green, and blue components in the image are + * stored in 4-byte pixels in the order R, G, B from highest to lowest byte + * address within each pixel. The X component is ignored when compressing + * and undefined when decompressing. + */ + TJPF_XBGR, + /** + * XRGB pixel format. The red, green, and blue components in the image are + * stored in 4-byte pixels in the order B, G, R from highest to lowest byte + * address within each pixel. The X component is ignored when compressing + * and undefined when decompressing. + */ + TJPF_XRGB, + /** + * Grayscale pixel format. Each 1-byte pixel represents a luminance + * (brightness) level from 0 to 255. + */ + TJPF_GRAY, + /** + * RGBA pixel format. This is the same as @ref TJPF_RGBX, except that when + * decompressing, the X component is guaranteed to be 0xFF, which can be + * interpreted as an opaque alpha channel. + */ + TJPF_RGBA, + /** + * BGRA pixel format. This is the same as @ref TJPF_BGRX, except that when + * decompressing, the X component is guaranteed to be 0xFF, which can be + * interpreted as an opaque alpha channel. + */ + TJPF_BGRA, + /** + * ABGR pixel format. This is the same as @ref TJPF_XBGR, except that when + * decompressing, the X component is guaranteed to be 0xFF, which can be + * interpreted as an opaque alpha channel. + */ + TJPF_ABGR, + /** + * ARGB pixel format. This is the same as @ref TJPF_XRGB, except that when + * decompressing, the X component is guaranteed to be 0xFF, which can be + * interpreted as an opaque alpha channel. + */ + TJPF_ARGB, + /** + * CMYK pixel format. Unlike RGB, which is an additive color model used + * primarily for display, CMYK (Cyan/Magenta/Yellow/Key) is a subtractive + * color model used primarily for printing. In the CMYK color model, the + * value of each color component typically corresponds to an amount of cyan, + * magenta, yellow, or black ink that is applied to a white background. In + * order to convert between CMYK and RGB, it is necessary to use a color + * management system (CMS.) A CMS will attempt to map colors within the + * printer's gamut to perceptually similar colors in the display's gamut and + * vice versa, but the mapping is typically not 1:1 or reversible, nor can it + * be defined with a simple formula. Thus, such a conversion is out of scope + * for a codec library. However, the TurboJPEG API allows for compressing + * CMYK pixels into a YCCK JPEG image (see #TJCS_YCCK) and decompressing YCCK + * JPEG images into CMYK pixels. + */ + TJPF_CMYK, + /** + * Unknown pixel format. Currently this is only used by #tjLoadImage(). + */ + TJPF_UNKNOWN = -1 +}; + +/** + * Red offset (in bytes) for a given pixel format. This specifies the number + * of bytes that the red component is offset from the start of the pixel. For + * instance, if a pixel of format TJ_BGRX is stored in char pixel[], + * then the red component will be pixel[tjRedOffset[TJ_BGRX]]. This + * will be -1 if the pixel format does not have a red component. + */ +static const int tjRedOffset[TJ_NUMPF] = { + 0, 2, 0, 2, 3, 1, -1, 0, 2, 3, 1, -1 +}; +/** + * Green offset (in bytes) for a given pixel format. This specifies the number + * of bytes that the green component is offset from the start of the pixel. + * For instance, if a pixel of format TJ_BGRX is stored in + * char pixel[], then the green component will be + * pixel[tjGreenOffset[TJ_BGRX]]. This will be -1 if the pixel format + * does not have a green component. + */ +static const int tjGreenOffset[TJ_NUMPF] = { + 1, 1, 1, 1, 2, 2, -1, 1, 1, 2, 2, -1 +}; +/** + * Blue offset (in bytes) for a given pixel format. This specifies the number + * of bytes that the Blue component is offset from the start of the pixel. For + * instance, if a pixel of format TJ_BGRX is stored in char pixel[], + * then the blue component will be pixel[tjBlueOffset[TJ_BGRX]]. This + * will be -1 if the pixel format does not have a blue component. + */ +static const int tjBlueOffset[TJ_NUMPF] = { + 2, 0, 2, 0, 1, 3, -1, 2, 0, 1, 3, -1 +}; +/** + * Alpha offset (in bytes) for a given pixel format. This specifies the number + * of bytes that the Alpha component is offset from the start of the pixel. + * For instance, if a pixel of format TJ_BGRA is stored in + * char pixel[], then the alpha component will be + * pixel[tjAlphaOffset[TJ_BGRA]]. This will be -1 if the pixel format + * does not have an alpha component. + */ +static const int tjAlphaOffset[TJ_NUMPF] = { + -1, -1, -1, -1, -1, -1, -1, 3, 3, 0, 0, -1 +}; +/** + * Pixel size (in bytes) for a given pixel format + */ +static const int tjPixelSize[TJ_NUMPF] = { + 3, 3, 4, 4, 4, 4, 1, 4, 4, 4, 4, 4 +}; + + +/** + * The number of JPEG colorspaces + */ +#define TJ_NUMCS 5 + +/** + * JPEG colorspaces + */ +enum TJCS { + /** + * RGB colorspace. When compressing the JPEG image, the R, G, and B + * components in the source image are reordered into image planes, but no + * colorspace conversion or subsampling is performed. RGB JPEG images can be + * decompressed to any of the extended RGB pixel formats or grayscale, but + * they cannot be decompressed to YUV images. + */ + TJCS_RGB = 0, + /** + * YCbCr colorspace. YCbCr is not an absolute colorspace but rather a + * mathematical transformation of RGB designed solely for storage and + * transmission. YCbCr images must be converted to RGB before they can + * actually be displayed. In the YCbCr colorspace, the Y (luminance) + * component represents the black & white portion of the original image, and + * the Cb and Cr (chrominance) components represent the color portion of the + * original image. Originally, the analog equivalent of this transformation + * allowed the same signal to drive both black & white and color televisions, + * but JPEG images use YCbCr primarily because it allows the color data to be + * optionally subsampled for the purposes of reducing bandwidth or disk + * space. YCbCr is the most common JPEG colorspace, and YCbCr JPEG images + * can be compressed from and decompressed to any of the extended RGB pixel + * formats or grayscale, or they can be decompressed to YUV planar images. + */ + TJCS_YCbCr, + /** + * Grayscale colorspace. The JPEG image retains only the luminance data (Y + * component), and any color data from the source image is discarded. + * Grayscale JPEG images can be compressed from and decompressed to any of + * the extended RGB pixel formats or grayscale, or they can be decompressed + * to YUV planar images. + */ + TJCS_GRAY, + /** + * CMYK colorspace. When compressing the JPEG image, the C, M, Y, and K + * components in the source image are reordered into image planes, but no + * colorspace conversion or subsampling is performed. CMYK JPEG images can + * only be decompressed to CMYK pixels. + */ + TJCS_CMYK, + /** + * YCCK colorspace. YCCK (AKA "YCbCrK") is not an absolute colorspace but + * rather a mathematical transformation of CMYK designed solely for storage + * and transmission. It is to CMYK as YCbCr is to RGB. CMYK pixels can be + * reversibly transformed into YCCK, and as with YCbCr, the chrominance + * components in the YCCK pixels can be subsampled without incurring major + * perceptual loss. YCCK JPEG images can only be compressed from and + * decompressed to CMYK pixels. + */ + TJCS_YCCK +}; + + +/** + * The uncompressed source/destination image is stored in bottom-up (Windows, + * OpenGL) order, not top-down (X11) order. + */ +#define TJFLAG_BOTTOMUP 2 +/** + * When decompressing an image that was compressed using chrominance + * subsampling, use the fastest chrominance upsampling algorithm available in + * the underlying codec. The default is to use smooth upsampling, which + * creates a smooth transition between neighboring chrominance components in + * order to reduce upsampling artifacts in the decompressed image. + */ +#define TJFLAG_FASTUPSAMPLE 256 +/** + * Disable buffer (re)allocation. If passed to one of the JPEG compression or + * transform functions, this flag will cause those functions to generate an + * error if the JPEG image buffer is invalid or too small rather than + * attempting to allocate or reallocate that buffer. This reproduces the + * behavior of earlier versions of TurboJPEG. + */ +#define TJFLAG_NOREALLOC 1024 +/** + * Use the fastest DCT/IDCT algorithm available in the underlying codec. The + * default if this flag is not specified is implementation-specific. For + * example, the implementation of TurboJPEG for libjpeg[-turbo] uses the fast + * algorithm by default when compressing, because this has been shown to have + * only a very slight effect on accuracy, but it uses the accurate algorithm + * when decompressing, because this has been shown to have a larger effect. + */ +#define TJFLAG_FASTDCT 2048 +/** + * Use the most accurate DCT/IDCT algorithm available in the underlying codec. + * The default if this flag is not specified is implementation-specific. For + * example, the implementation of TurboJPEG for libjpeg[-turbo] uses the fast + * algorithm by default when compressing, because this has been shown to have + * only a very slight effect on accuracy, but it uses the accurate algorithm + * when decompressing, because this has been shown to have a larger effect. + */ +#define TJFLAG_ACCURATEDCT 4096 +/** + * Immediately discontinue the current compression/decompression/transform + * operation if the underlying codec throws a warning (non-fatal error). The + * default behavior is to allow the operation to complete unless a fatal error + * is encountered. + */ +#define TJFLAG_STOPONWARNING 8192 +/** + * Use progressive entropy coding in JPEG images generated by the compression + * and transform functions. Progressive entropy coding will generally improve + * compression relative to baseline entropy coding (the default), but it will + * reduce compression and decompression performance considerably. + */ +#define TJFLAG_PROGRESSIVE 16384 + + +/** + * The number of error codes + */ +#define TJ_NUMERR 2 + +/** + * Error codes + */ +enum TJERR { + /** + * The error was non-fatal and recoverable, but the image may still be + * corrupt. + */ + TJERR_WARNING = 0, + /** + * The error was fatal and non-recoverable. + */ + TJERR_FATAL +}; + + +/** + * The number of transform operations + */ +#define TJ_NUMXOP 8 + +/** + * Transform operations for #tjTransform() + */ +enum TJXOP { + /** + * Do not transform the position of the image pixels + */ + TJXOP_NONE = 0, + /** + * Flip (mirror) image horizontally. This transform is imperfect if there + * are any partial MCU blocks on the right edge (see #TJXOPT_PERFECT.) + */ + TJXOP_HFLIP, + /** + * Flip (mirror) image vertically. This transform is imperfect if there are + * any partial MCU blocks on the bottom edge (see #TJXOPT_PERFECT.) + */ + TJXOP_VFLIP, + /** + * Transpose image (flip/mirror along upper left to lower right axis.) This + * transform is always perfect. + */ + TJXOP_TRANSPOSE, + /** + * Transverse transpose image (flip/mirror along upper right to lower left + * axis.) This transform is imperfect if there are any partial MCU blocks in + * the image (see #TJXOPT_PERFECT.) + */ + TJXOP_TRANSVERSE, + /** + * Rotate image clockwise by 90 degrees. This transform is imperfect if + * there are any partial MCU blocks on the bottom edge (see + * #TJXOPT_PERFECT.) + */ + TJXOP_ROT90, + /** + * Rotate image 180 degrees. This transform is imperfect if there are any + * partial MCU blocks in the image (see #TJXOPT_PERFECT.) + */ + TJXOP_ROT180, + /** + * Rotate image counter-clockwise by 90 degrees. This transform is imperfect + * if there are any partial MCU blocks on the right edge (see + * #TJXOPT_PERFECT.) + */ + TJXOP_ROT270 +}; + + +/** + * This option will cause #tjTransform() to return an error if the transform is + * not perfect. Lossless transforms operate on MCU blocks, whose size depends + * on the level of chrominance subsampling used (see #tjMCUWidth + * and #tjMCUHeight.) If the image's width or height is not evenly divisible + * by the MCU block size, then there will be partial MCU blocks on the right + * and/or bottom edges. It is not possible to move these partial MCU blocks to + * the top or left of the image, so any transform that would require that is + * "imperfect." If this option is not specified, then any partial MCU blocks + * that cannot be transformed will be left in place, which will create + * odd-looking strips on the right or bottom edge of the image. + */ +#define TJXOPT_PERFECT 1 +/** + * This option will cause #tjTransform() to discard any partial MCU blocks that + * cannot be transformed. + */ +#define TJXOPT_TRIM 2 +/** + * This option will enable lossless cropping. See #tjTransform() for more + * information. + */ +#define TJXOPT_CROP 4 +/** + * This option will discard the color data in the input image and produce + * a grayscale output image. + */ +#define TJXOPT_GRAY 8 +/** + * This option will prevent #tjTransform() from outputting a JPEG image for + * this particular transform (this can be used in conjunction with a custom + * filter to capture the transformed DCT coefficients without transcoding + * them.) + */ +#define TJXOPT_NOOUTPUT 16 +/** + * This option will enable progressive entropy coding in the output image + * generated by this particular transform. Progressive entropy coding will + * generally improve compression relative to baseline entropy coding (the + * default), but it will reduce compression and decompression performance + * considerably. + */ +#define TJXOPT_PROGRESSIVE 32 +/** + * This option will prevent #tjTransform() from copying any extra markers + * (including EXIF and ICC profile data) from the source image to the output + * image. + */ +#define TJXOPT_COPYNONE 64 + + +/** + * Scaling factor + */ +typedef struct { + /** + * Numerator + */ + int num; + /** + * Denominator + */ + int denom; +} tjscalingfactor; + +/** + * Cropping region + */ +typedef struct { + /** + * The left boundary of the cropping region. This must be evenly divisible + * by the MCU block width (see #tjMCUWidth.) + */ + int x; + /** + * The upper boundary of the cropping region. This must be evenly divisible + * by the MCU block height (see #tjMCUHeight.) + */ + int y; + /** + * The width of the cropping region. Setting this to 0 is the equivalent of + * setting it to the width of the source JPEG image - x. + */ + int w; + /** + * The height of the cropping region. Setting this to 0 is the equivalent of + * setting it to the height of the source JPEG image - y. + */ + int h; +} tjregion; + +/** + * Lossless transform + */ +typedef struct tjtransform { + /** + * Cropping region + */ + tjregion r; + /** + * One of the @ref TJXOP "transform operations" + */ + int op; + /** + * The bitwise OR of one of more of the @ref TJXOPT_CROP "transform options" + */ + int options; + /** + * Arbitrary data that can be accessed within the body of the callback + * function + */ + void *data; + /** + * A callback function that can be used to modify the DCT coefficients + * after they are losslessly transformed but before they are transcoded to a + * new JPEG image. This allows for custom filters or other transformations + * to be applied in the frequency domain. + * + * @param coeffs pointer to an array of transformed DCT coefficients. (NOTE: + * this pointer is not guaranteed to be valid once the callback returns, so + * applications wishing to hand off the DCT coefficients to another function + * or library should make a copy of them within the body of the callback.) + * + * @param arrayRegion #tjregion structure containing the width and height of + * the array pointed to by coeffs as well as its offset relative to + * the component plane. TurboJPEG implementations may choose to split each + * component plane into multiple DCT coefficient arrays and call the callback + * function once for each array. + * + * @param planeRegion #tjregion structure containing the width and height of + * the component plane to which coeffs belongs + * + * @param componentID ID number of the component plane to which + * coeffs belongs (Y, Cb, and Cr have, respectively, ID's of 0, 1, + * and 2 in typical JPEG images.) + * + * @param transformID ID number of the transformed image to which + * coeffs belongs. This is the same as the index of the transform + * in the transforms array that was passed to #tjTransform(). + * + * @param transform a pointer to a #tjtransform structure that specifies the + * parameters and/or cropping region for this transform + * + * @return 0 if the callback was successful, or -1 if an error occurred. + */ + int (*customFilter) (short *coeffs, tjregion arrayRegion, + tjregion planeRegion, int componentIndex, + int transformIndex, struct tjtransform *transform); +} tjtransform; + +/** + * TurboJPEG instance handle + */ +typedef void *tjhandle; + + +/** + * Pad the given width to the nearest 32-bit boundary + */ +#define TJPAD(width) (((width) + 3) & (~3)) + +/** + * Compute the scaled value of dimension using the given scaling + * factor. This macro performs the integer equivalent of ceil(dimension * + * scalingFactor). + */ +#define TJSCALED(dimension, scalingFactor) \ + ((dimension * scalingFactor.num + scalingFactor.denom - 1) / \ + scalingFactor.denom) + + +#ifdef __cplusplus +extern "C" { +#endif + + +/** + * Create a TurboJPEG compressor instance. + * + * @return a handle to the newly-created instance, or NULL if an error + * occurred (see #tjGetErrorStr2().) + */ +DLLEXPORT tjhandle tjInitCompress(void); + + +/** + * Compress an RGB, grayscale, or CMYK image into a JPEG image. + * + * @param handle a handle to a TurboJPEG compressor or transformer instance + * + * @param srcBuf pointer to an image buffer containing RGB, grayscale, or + * CMYK pixels to be compressed + * + * @param width width (in pixels) of the source image + * + * @param pitch bytes per line in the source image. Normally, this should be + * width * #tjPixelSize[pixelFormat] if the image is unpadded, or + * #TJPAD(width * #tjPixelSize[pixelFormat]) if each line of the image + * is padded to the nearest 32-bit boundary, as is the case for Windows + * bitmaps. You can also be clever and use this parameter to skip lines, etc. + * Setting this parameter to 0 is the equivalent of setting it to + * width * #tjPixelSize[pixelFormat]. + * + * @param height height (in pixels) of the source image + * + * @param pixelFormat pixel format of the source image (see @ref TJPF + * "Pixel formats".) + * + * @param jpegBuf address of a pointer to an image buffer that will receive the + * JPEG image. TurboJPEG has the ability to reallocate the JPEG buffer + * to accommodate the size of the JPEG image. Thus, you can choose to: + * -# pre-allocate the JPEG buffer with an arbitrary size using #tjAlloc() and + * let TurboJPEG grow the buffer as needed, + * -# set *jpegBuf to NULL to tell TurboJPEG to allocate the buffer + * for you, or + * -# pre-allocate the buffer to a "worst case" size determined by calling + * #tjBufSize(). This should ensure that the buffer never has to be + * re-allocated (setting #TJFLAG_NOREALLOC guarantees that it won't be.) + * . + * If you choose option 1, *jpegSize should be set to the size of your + * pre-allocated buffer. In any case, unless you have set #TJFLAG_NOREALLOC, + * you should always check *jpegBuf upon return from this function, as + * it may have changed. + * + * @param jpegSize pointer to an unsigned long variable that holds the size of + * the JPEG image buffer. If *jpegBuf points to a pre-allocated + * buffer, then *jpegSize should be set to the size of the buffer. + * Upon return, *jpegSize will contain the size of the JPEG image (in + * bytes.) If *jpegBuf points to a JPEG image buffer that is being + * reused from a previous call to one of the JPEG compression functions, then + * *jpegSize is ignored. + * + * @param jpegSubsamp the level of chrominance subsampling to be used when + * generating the JPEG image (see @ref TJSAMP + * "Chrominance subsampling options".) + * + * @param jpegQual the image quality of the generated JPEG image (1 = worst, + * 100 = best) + * + * @param flags the bitwise OR of one or more of the @ref TJFLAG_ACCURATEDCT + * "flags" + * + * @return 0 if successful, or -1 if an error occurred (see #tjGetErrorStr2() + * and #tjGetErrorCode().) +*/ +DLLEXPORT int tjCompress2(tjhandle handle, const unsigned char *srcBuf, + int width, int pitch, int height, int pixelFormat, + unsigned char **jpegBuf, unsigned long *jpegSize, + int jpegSubsamp, int jpegQual, int flags); + + +/** + * Compress a YUV planar image into a JPEG image. + * + * @param handle a handle to a TurboJPEG compressor or transformer instance + * + * @param srcBuf pointer to an image buffer containing a YUV planar image to be + * compressed. The size of this buffer should match the value returned by + * #tjBufSizeYUV2() for the given image width, height, padding, and level of + * chrominance subsampling. The Y, U (Cb), and V (Cr) image planes should be + * stored sequentially in the source buffer (refer to @ref YUVnotes + * "YUV Image Format Notes".) + * + * @param width width (in pixels) of the source image. If the width is not an + * even multiple of the MCU block width (see #tjMCUWidth), then an intermediate + * buffer copy will be performed within TurboJPEG. + * + * @param pad the line padding used in the source image. For instance, if each + * line in each plane of the YUV image is padded to the nearest multiple of 4 + * bytes, then pad should be set to 4. + * + * @param height height (in pixels) of the source image. If the height is not + * an even multiple of the MCU block height (see #tjMCUHeight), then an + * intermediate buffer copy will be performed within TurboJPEG. + * + * @param subsamp the level of chrominance subsampling used in the source + * image (see @ref TJSAMP "Chrominance subsampling options".) + * + * @param jpegBuf address of a pointer to an image buffer that will receive the + * JPEG image. TurboJPEG has the ability to reallocate the JPEG buffer to + * accommodate the size of the JPEG image. Thus, you can choose to: + * -# pre-allocate the JPEG buffer with an arbitrary size using #tjAlloc() and + * let TurboJPEG grow the buffer as needed, + * -# set *jpegBuf to NULL to tell TurboJPEG to allocate the buffer + * for you, or + * -# pre-allocate the buffer to a "worst case" size determined by calling + * #tjBufSize(). This should ensure that the buffer never has to be + * re-allocated (setting #TJFLAG_NOREALLOC guarantees that it won't be.) + * . + * If you choose option 1, *jpegSize should be set to the size of your + * pre-allocated buffer. In any case, unless you have set #TJFLAG_NOREALLOC, + * you should always check *jpegBuf upon return from this function, as + * it may have changed. + * + * @param jpegSize pointer to an unsigned long variable that holds the size of + * the JPEG image buffer. If *jpegBuf points to a pre-allocated + * buffer, then *jpegSize should be set to the size of the buffer. + * Upon return, *jpegSize will contain the size of the JPEG image (in + * bytes.) If *jpegBuf points to a JPEG image buffer that is being + * reused from a previous call to one of the JPEG compression functions, then + * *jpegSize is ignored. + * + * @param jpegQual the image quality of the generated JPEG image (1 = worst, + * 100 = best) + * + * @param flags the bitwise OR of one or more of the @ref TJFLAG_ACCURATEDCT + * "flags" + * + * @return 0 if successful, or -1 if an error occurred (see #tjGetErrorStr2() + * and #tjGetErrorCode().) +*/ +DLLEXPORT int tjCompressFromYUV(tjhandle handle, const unsigned char *srcBuf, + int width, int pad, int height, int subsamp, + unsigned char **jpegBuf, + unsigned long *jpegSize, int jpegQual, + int flags); + + +/** + * Compress a set of Y, U (Cb), and V (Cr) image planes into a JPEG image. + * + * @param handle a handle to a TurboJPEG compressor or transformer instance + * + * @param srcPlanes an array of pointers to Y, U (Cb), and V (Cr) image planes + * (or just a Y plane, if compressing a grayscale image) that contain a YUV + * image to be compressed. These planes can be contiguous or non-contiguous in + * memory. The size of each plane should match the value returned by + * #tjPlaneSizeYUV() for the given image width, height, strides, and level of + * chrominance subsampling. Refer to @ref YUVnotes "YUV Image Format Notes" + * for more details. + * + * @param width width (in pixels) of the source image. If the width is not an + * even multiple of the MCU block width (see #tjMCUWidth), then an intermediate + * buffer copy will be performed within TurboJPEG. + * + * @param strides an array of integers, each specifying the number of bytes per + * line in the corresponding plane of the YUV source image. Setting the stride + * for any plane to 0 is the same as setting it to the plane width (see + * @ref YUVnotes "YUV Image Format Notes".) If strides is NULL, then + * the strides for all planes will be set to their respective plane widths. + * You can adjust the strides in order to specify an arbitrary amount of line + * padding in each plane or to create a JPEG image from a subregion of a larger + * YUV planar image. + * + * @param height height (in pixels) of the source image. If the height is not + * an even multiple of the MCU block height (see #tjMCUHeight), then an + * intermediate buffer copy will be performed within TurboJPEG. + * + * @param subsamp the level of chrominance subsampling used in the source + * image (see @ref TJSAMP "Chrominance subsampling options".) + * + * @param jpegBuf address of a pointer to an image buffer that will receive the + * JPEG image. TurboJPEG has the ability to reallocate the JPEG buffer to + * accommodate the size of the JPEG image. Thus, you can choose to: + * -# pre-allocate the JPEG buffer with an arbitrary size using #tjAlloc() and + * let TurboJPEG grow the buffer as needed, + * -# set *jpegBuf to NULL to tell TurboJPEG to allocate the buffer + * for you, or + * -# pre-allocate the buffer to a "worst case" size determined by calling + * #tjBufSize(). This should ensure that the buffer never has to be + * re-allocated (setting #TJFLAG_NOREALLOC guarantees that it won't be.) + * . + * If you choose option 1, *jpegSize should be set to the size of your + * pre-allocated buffer. In any case, unless you have set #TJFLAG_NOREALLOC, + * you should always check *jpegBuf upon return from this function, as + * it may have changed. + * + * @param jpegSize pointer to an unsigned long variable that holds the size of + * the JPEG image buffer. If *jpegBuf points to a pre-allocated + * buffer, then *jpegSize should be set to the size of the buffer. + * Upon return, *jpegSize will contain the size of the JPEG image (in + * bytes.) If *jpegBuf points to a JPEG image buffer that is being + * reused from a previous call to one of the JPEG compression functions, then + * *jpegSize is ignored. + * + * @param jpegQual the image quality of the generated JPEG image (1 = worst, + * 100 = best) + * + * @param flags the bitwise OR of one or more of the @ref TJFLAG_ACCURATEDCT + * "flags" + * + * @return 0 if successful, or -1 if an error occurred (see #tjGetErrorStr2() + * and #tjGetErrorCode().) +*/ +DLLEXPORT int tjCompressFromYUVPlanes(tjhandle handle, + const unsigned char **srcPlanes, + int width, const int *strides, + int height, int subsamp, + unsigned char **jpegBuf, + unsigned long *jpegSize, int jpegQual, + int flags); + + +/** + * The maximum size of the buffer (in bytes) required to hold a JPEG image with + * the given parameters. The number of bytes returned by this function is + * larger than the size of the uncompressed source image. The reason for this + * is that the JPEG format uses 16-bit coefficients, and it is thus possible + * for a very high-quality JPEG image with very high-frequency content to + * expand rather than compress when converted to the JPEG format. Such images + * represent a very rare corner case, but since there is no way to predict the + * size of a JPEG image prior to compression, the corner case has to be + * handled. + * + * @param width width (in pixels) of the image + * + * @param height height (in pixels) of the image + * + * @param jpegSubsamp the level of chrominance subsampling to be used when + * generating the JPEG image (see @ref TJSAMP + * "Chrominance subsampling options".) + * + * @return the maximum size of the buffer (in bytes) required to hold the + * image, or -1 if the arguments are out of bounds. + */ +DLLEXPORT unsigned long tjBufSize(int width, int height, int jpegSubsamp); + + +/** + * The size of the buffer (in bytes) required to hold a YUV planar image with + * the given parameters. + * + * @param width width (in pixels) of the image + * + * @param pad the width of each line in each plane of the image is padded to + * the nearest multiple of this number of bytes (must be a power of 2.) + * + * @param height height (in pixels) of the image + * + * @param subsamp level of chrominance subsampling in the image (see + * @ref TJSAMP "Chrominance subsampling options".) + * + * @return the size of the buffer (in bytes) required to hold the image, or + * -1 if the arguments are out of bounds. + */ +DLLEXPORT unsigned long tjBufSizeYUV2(int width, int pad, int height, + int subsamp); + + +/** + * The size of the buffer (in bytes) required to hold a YUV image plane with + * the given parameters. + * + * @param componentID ID number of the image plane (0 = Y, 1 = U/Cb, 2 = V/Cr) + * + * @param width width (in pixels) of the YUV image. NOTE: this is the width of + * the whole image, not the plane width. + * + * @param stride bytes per line in the image plane. Setting this to 0 is the + * equivalent of setting it to the plane width. + * + * @param height height (in pixels) of the YUV image. NOTE: this is the height + * of the whole image, not the plane height. + * + * @param subsamp level of chrominance subsampling in the image (see + * @ref TJSAMP "Chrominance subsampling options".) + * + * @return the size of the buffer (in bytes) required to hold the YUV image + * plane, or -1 if the arguments are out of bounds. + */ +DLLEXPORT unsigned long tjPlaneSizeYUV(int componentID, int width, int stride, + int height, int subsamp); + + +/** + * The plane width of a YUV image plane with the given parameters. Refer to + * @ref YUVnotes "YUV Image Format Notes" for a description of plane width. + * + * @param componentID ID number of the image plane (0 = Y, 1 = U/Cb, 2 = V/Cr) + * + * @param width width (in pixels) of the YUV image + * + * @param subsamp level of chrominance subsampling in the image (see + * @ref TJSAMP "Chrominance subsampling options".) + * + * @return the plane width of a YUV image plane with the given parameters, or + * -1 if the arguments are out of bounds. + */ +DLLEXPORT int tjPlaneWidth(int componentID, int width, int subsamp); + + +/** + * The plane height of a YUV image plane with the given parameters. Refer to + * @ref YUVnotes "YUV Image Format Notes" for a description of plane height. + * + * @param componentID ID number of the image plane (0 = Y, 1 = U/Cb, 2 = V/Cr) + * + * @param height height (in pixels) of the YUV image + * + * @param subsamp level of chrominance subsampling in the image (see + * @ref TJSAMP "Chrominance subsampling options".) + * + * @return the plane height of a YUV image plane with the given parameters, or + * -1 if the arguments are out of bounds. + */ +DLLEXPORT int tjPlaneHeight(int componentID, int height, int subsamp); + + +/** + * Encode an RGB or grayscale image into a YUV planar image. This function + * uses the accelerated color conversion routines in the underlying + * codec but does not execute any of the other steps in the JPEG compression + * process. + * + * @param handle a handle to a TurboJPEG compressor or transformer instance + * + * @param srcBuf pointer to an image buffer containing RGB or grayscale pixels + * to be encoded + * + * @param width width (in pixels) of the source image + * + * @param pitch bytes per line in the source image. Normally, this should be + * width * #tjPixelSize[pixelFormat] if the image is unpadded, or + * #TJPAD(width * #tjPixelSize[pixelFormat]) if each line of the image + * is padded to the nearest 32-bit boundary, as is the case for Windows + * bitmaps. You can also be clever and use this parameter to skip lines, etc. + * Setting this parameter to 0 is the equivalent of setting it to + * width * #tjPixelSize[pixelFormat]. + * + * @param height height (in pixels) of the source image + * + * @param pixelFormat pixel format of the source image (see @ref TJPF + * "Pixel formats".) + * + * @param dstBuf pointer to an image buffer that will receive the YUV image. + * Use #tjBufSizeYUV2() to determine the appropriate size for this buffer based + * on the image width, height, padding, and level of chrominance subsampling. + * The Y, U (Cb), and V (Cr) image planes will be stored sequentially in the + * buffer (refer to @ref YUVnotes "YUV Image Format Notes".) + * + * @param pad the width of each line in each plane of the YUV image will be + * padded to the nearest multiple of this number of bytes (must be a power of + * 2.) To generate images suitable for X Video, pad should be set to + * 4. + * + * @param subsamp the level of chrominance subsampling to be used when + * generating the YUV image (see @ref TJSAMP + * "Chrominance subsampling options".) To generate images suitable for X + * Video, subsamp should be set to @ref TJSAMP_420. This produces an + * image compatible with the I420 (AKA "YUV420P") format. + * + * @param flags the bitwise OR of one or more of the @ref TJFLAG_ACCURATEDCT + * "flags" + * + * @return 0 if successful, or -1 if an error occurred (see #tjGetErrorStr2() + * and #tjGetErrorCode().) +*/ +DLLEXPORT int tjEncodeYUV3(tjhandle handle, const unsigned char *srcBuf, + int width, int pitch, int height, int pixelFormat, + unsigned char *dstBuf, int pad, int subsamp, + int flags); + + +/** + * Encode an RGB or grayscale image into separate Y, U (Cb), and V (Cr) image + * planes. This function uses the accelerated color conversion routines in the + * underlying codec but does not execute any of the other steps in the JPEG + * compression process. + * + * @param handle a handle to a TurboJPEG compressor or transformer instance + * + * @param srcBuf pointer to an image buffer containing RGB or grayscale pixels + * to be encoded + * + * @param width width (in pixels) of the source image + * + * @param pitch bytes per line in the source image. Normally, this should be + * width * #tjPixelSize[pixelFormat] if the image is unpadded, or + * #TJPAD(width * #tjPixelSize[pixelFormat]) if each line of the image + * is padded to the nearest 32-bit boundary, as is the case for Windows + * bitmaps. You can also be clever and use this parameter to skip lines, etc. + * Setting this parameter to 0 is the equivalent of setting it to + * width * #tjPixelSize[pixelFormat]. + * + * @param height height (in pixels) of the source image + * + * @param pixelFormat pixel format of the source image (see @ref TJPF + * "Pixel formats".) + * + * @param dstPlanes an array of pointers to Y, U (Cb), and V (Cr) image planes + * (or just a Y plane, if generating a grayscale image) that will receive the + * encoded image. These planes can be contiguous or non-contiguous in memory. + * Use #tjPlaneSizeYUV() to determine the appropriate size for each plane based + * on the image width, height, strides, and level of chrominance subsampling. + * Refer to @ref YUVnotes "YUV Image Format Notes" for more details. + * + * @param strides an array of integers, each specifying the number of bytes per + * line in the corresponding plane of the output image. Setting the stride for + * any plane to 0 is the same as setting it to the plane width (see + * @ref YUVnotes "YUV Image Format Notes".) If strides is NULL, then + * the strides for all planes will be set to their respective plane widths. + * You can adjust the strides in order to add an arbitrary amount of line + * padding to each plane or to encode an RGB or grayscale image into a + * subregion of a larger YUV planar image. + * + * @param subsamp the level of chrominance subsampling to be used when + * generating the YUV image (see @ref TJSAMP + * "Chrominance subsampling options".) To generate images suitable for X + * Video, subsamp should be set to @ref TJSAMP_420. This produces an + * image compatible with the I420 (AKA "YUV420P") format. + * + * @param flags the bitwise OR of one or more of the @ref TJFLAG_ACCURATEDCT + * "flags" + * + * @return 0 if successful, or -1 if an error occurred (see #tjGetErrorStr2() + * and #tjGetErrorCode().) +*/ +DLLEXPORT int tjEncodeYUVPlanes(tjhandle handle, const unsigned char *srcBuf, + int width, int pitch, int height, + int pixelFormat, unsigned char **dstPlanes, + int *strides, int subsamp, int flags); + + +/** + * Create a TurboJPEG decompressor instance. + * + * @return a handle to the newly-created instance, or NULL if an error + * occurred (see #tjGetErrorStr2().) +*/ +DLLEXPORT tjhandle tjInitDecompress(void); + + +/** + * Retrieve information about a JPEG image without decompressing it. + * + * @param handle a handle to a TurboJPEG decompressor or transformer instance + * + * @param jpegBuf pointer to a buffer containing a JPEG image + * + * @param jpegSize size of the JPEG image (in bytes) + * + * @param width pointer to an integer variable that will receive the width (in + * pixels) of the JPEG image + * + * @param height pointer to an integer variable that will receive the height + * (in pixels) of the JPEG image + * + * @param jpegSubsamp pointer to an integer variable that will receive the + * level of chrominance subsampling used when the JPEG image was compressed + * (see @ref TJSAMP "Chrominance subsampling options".) + * + * @param jpegColorspace pointer to an integer variable that will receive one + * of the JPEG colorspace constants, indicating the colorspace of the JPEG + * image (see @ref TJCS "JPEG colorspaces".) + * + * @return 0 if successful, or -1 if an error occurred (see #tjGetErrorStr2() + * and #tjGetErrorCode().) +*/ +DLLEXPORT int tjDecompressHeader3(tjhandle handle, + const unsigned char *jpegBuf, + unsigned long jpegSize, int *width, + int *height, int *jpegSubsamp, + int *jpegColorspace); + + +/** + * Returns a list of fractional scaling factors that the JPEG decompressor in + * this implementation of TurboJPEG supports. + * + * @param numscalingfactors pointer to an integer variable that will receive + * the number of elements in the list + * + * @return a pointer to a list of fractional scaling factors, or NULL if an + * error is encountered (see #tjGetErrorStr2().) +*/ +DLLEXPORT tjscalingfactor *tjGetScalingFactors(int *numscalingfactors); + + +/** + * Decompress a JPEG image to an RGB, grayscale, or CMYK image. + * + * @param handle a handle to a TurboJPEG decompressor or transformer instance + * + * @param jpegBuf pointer to a buffer containing the JPEG image to decompress + * + * @param jpegSize size of the JPEG image (in bytes) + * + * @param dstBuf pointer to an image buffer that will receive the decompressed + * image. This buffer should normally be pitch * scaledHeight bytes + * in size, where scaledHeight can be determined by calling + * #TJSCALED() with the JPEG image height and one of the scaling factors + * returned by #tjGetScalingFactors(). The dstBuf pointer may also be + * used to decompress into a specific region of a larger buffer. + * + * @param width desired width (in pixels) of the destination image. If this is + * different than the width of the JPEG image being decompressed, then + * TurboJPEG will use scaling in the JPEG decompressor to generate the largest + * possible image that will fit within the desired width. If width is + * set to 0, then only the height will be considered when determining the + * scaled image size. + * + * @param pitch bytes per line in the destination image. Normally, this is + * scaledWidth * #tjPixelSize[pixelFormat] if the decompressed image + * is unpadded, else #TJPAD(scaledWidth * #tjPixelSize[pixelFormat]) + * if each line of the decompressed image is padded to the nearest 32-bit + * boundary, as is the case for Windows bitmaps. (NOTE: scaledWidth + * can be determined by calling #TJSCALED() with the JPEG image width and one + * of the scaling factors returned by #tjGetScalingFactors().) You can also be + * clever and use the pitch parameter to skip lines, etc. Setting this + * parameter to 0 is the equivalent of setting it to + * scaledWidth * #tjPixelSize[pixelFormat]. + * + * @param height desired height (in pixels) of the destination image. If this + * is different than the height of the JPEG image being decompressed, then + * TurboJPEG will use scaling in the JPEG decompressor to generate the largest + * possible image that will fit within the desired height. If height + * is set to 0, then only the width will be considered when determining the + * scaled image size. + * + * @param pixelFormat pixel format of the destination image (see @ref + * TJPF "Pixel formats".) + * + * @param flags the bitwise OR of one or more of the @ref TJFLAG_ACCURATEDCT + * "flags" + * + * @return 0 if successful, or -1 if an error occurred (see #tjGetErrorStr2() + * and #tjGetErrorCode().) + */ +DLLEXPORT int tjDecompress2(tjhandle handle, const unsigned char *jpegBuf, + unsigned long jpegSize, unsigned char *dstBuf, + int width, int pitch, int height, int pixelFormat, + int flags); + + +/** + * Decompress a JPEG image to a YUV planar image. This function performs JPEG + * decompression but leaves out the color conversion step, so a planar YUV + * image is generated instead of an RGB image. + * + * @param handle a handle to a TurboJPEG decompressor or transformer instance + * + * @param jpegBuf pointer to a buffer containing the JPEG image to decompress + * + * @param jpegSize size of the JPEG image (in bytes) + * + * @param dstBuf pointer to an image buffer that will receive the YUV image. + * Use #tjBufSizeYUV2() to determine the appropriate size for this buffer based + * on the image width, height, padding, and level of subsampling. The Y, + * U (Cb), and V (Cr) image planes will be stored sequentially in the buffer + * (refer to @ref YUVnotes "YUV Image Format Notes".) + * + * @param width desired width (in pixels) of the YUV image. If this is + * different than the width of the JPEG image being decompressed, then + * TurboJPEG will use scaling in the JPEG decompressor to generate the largest + * possible image that will fit within the desired width. If width is + * set to 0, then only the height will be considered when determining the + * scaled image size. If the scaled width is not an even multiple of the MCU + * block width (see #tjMCUWidth), then an intermediate buffer copy will be + * performed within TurboJPEG. + * + * @param pad the width of each line in each plane of the YUV image will be + * padded to the nearest multiple of this number of bytes (must be a power of + * 2.) To generate images suitable for X Video, pad should be set to + * 4. + * + * @param height desired height (in pixels) of the YUV image. If this is + * different than the height of the JPEG image being decompressed, then + * TurboJPEG will use scaling in the JPEG decompressor to generate the largest + * possible image that will fit within the desired height. If height + * is set to 0, then only the width will be considered when determining the + * scaled image size. If the scaled height is not an even multiple of the MCU + * block height (see #tjMCUHeight), then an intermediate buffer copy will be + * performed within TurboJPEG. + * + * @param flags the bitwise OR of one or more of the @ref TJFLAG_ACCURATEDCT + * "flags" + * + * @return 0 if successful, or -1 if an error occurred (see #tjGetErrorStr2() + * and #tjGetErrorCode().) + */ +DLLEXPORT int tjDecompressToYUV2(tjhandle handle, const unsigned char *jpegBuf, + unsigned long jpegSize, unsigned char *dstBuf, + int width, int pad, int height, int flags); + + +/** + * Decompress a JPEG image into separate Y, U (Cb), and V (Cr) image + * planes. This function performs JPEG decompression but leaves out the color + * conversion step, so a planar YUV image is generated instead of an RGB image. + * + * @param handle a handle to a TurboJPEG decompressor or transformer instance + * + * @param jpegBuf pointer to a buffer containing the JPEG image to decompress + * + * @param jpegSize size of the JPEG image (in bytes) + * + * @param dstPlanes an array of pointers to Y, U (Cb), and V (Cr) image planes + * (or just a Y plane, if decompressing a grayscale image) that will receive + * the YUV image. These planes can be contiguous or non-contiguous in memory. + * Use #tjPlaneSizeYUV() to determine the appropriate size for each plane based + * on the scaled image width, scaled image height, strides, and level of + * chrominance subsampling. Refer to @ref YUVnotes "YUV Image Format Notes" + * for more details. + * + * @param width desired width (in pixels) of the YUV image. If this is + * different than the width of the JPEG image being decompressed, then + * TurboJPEG will use scaling in the JPEG decompressor to generate the largest + * possible image that will fit within the desired width. If width is + * set to 0, then only the height will be considered when determining the + * scaled image size. If the scaled width is not an even multiple of the MCU + * block width (see #tjMCUWidth), then an intermediate buffer copy will be + * performed within TurboJPEG. + * + * @param strides an array of integers, each specifying the number of bytes per + * line in the corresponding plane of the output image. Setting the stride for + * any plane to 0 is the same as setting it to the scaled plane width (see + * @ref YUVnotes "YUV Image Format Notes".) If strides is NULL, then + * the strides for all planes will be set to their respective scaled plane + * widths. You can adjust the strides in order to add an arbitrary amount of + * line padding to each plane or to decompress the JPEG image into a subregion + * of a larger YUV planar image. + * + * @param height desired height (in pixels) of the YUV image. If this is + * different than the height of the JPEG image being decompressed, then + * TurboJPEG will use scaling in the JPEG decompressor to generate the largest + * possible image that will fit within the desired height. If height + * is set to 0, then only the width will be considered when determining the + * scaled image size. If the scaled height is not an even multiple of the MCU + * block height (see #tjMCUHeight), then an intermediate buffer copy will be + * performed within TurboJPEG. + * + * @param flags the bitwise OR of one or more of the @ref TJFLAG_ACCURATEDCT + * "flags" + * + * @return 0 if successful, or -1 if an error occurred (see #tjGetErrorStr2() + * and #tjGetErrorCode().) + */ +DLLEXPORT int tjDecompressToYUVPlanes(tjhandle handle, + const unsigned char *jpegBuf, + unsigned long jpegSize, + unsigned char **dstPlanes, int width, + int *strides, int height, int flags); + + +/** + * Decode a YUV planar image into an RGB or grayscale image. This function + * uses the accelerated color conversion routines in the underlying + * codec but does not execute any of the other steps in the JPEG decompression + * process. + * + * @param handle a handle to a TurboJPEG decompressor or transformer instance + * + * @param srcBuf pointer to an image buffer containing a YUV planar image to be + * decoded. The size of this buffer should match the value returned by + * #tjBufSizeYUV2() for the given image width, height, padding, and level of + * chrominance subsampling. The Y, U (Cb), and V (Cr) image planes should be + * stored sequentially in the source buffer (refer to @ref YUVnotes + * "YUV Image Format Notes".) + * + * @param pad Use this parameter to specify that the width of each line in each + * plane of the YUV source image is padded to the nearest multiple of this + * number of bytes (must be a power of 2.) + * + * @param subsamp the level of chrominance subsampling used in the YUV source + * image (see @ref TJSAMP "Chrominance subsampling options".) + * + * @param dstBuf pointer to an image buffer that will receive the decoded + * image. This buffer should normally be pitch * height bytes in + * size, but the dstBuf pointer can also be used to decode into a + * specific region of a larger buffer. + * + * @param width width (in pixels) of the source and destination images + * + * @param pitch bytes per line in the destination image. Normally, this should + * be width * #tjPixelSize[pixelFormat] if the destination image is + * unpadded, or #TJPAD(width * #tjPixelSize[pixelFormat]) if each line + * of the destination image should be padded to the nearest 32-bit boundary, as + * is the case for Windows bitmaps. You can also be clever and use the pitch + * parameter to skip lines, etc. Setting this parameter to 0 is the equivalent + * of setting it to width * #tjPixelSize[pixelFormat]. + * + * @param height height (in pixels) of the source and destination images + * + * @param pixelFormat pixel format of the destination image (see @ref TJPF + * "Pixel formats".) + * + * @param flags the bitwise OR of one or more of the @ref TJFLAG_ACCURATEDCT + * "flags" + * + * @return 0 if successful, or -1 if an error occurred (see #tjGetErrorStr2() + * and #tjGetErrorCode().) + */ +DLLEXPORT int tjDecodeYUV(tjhandle handle, const unsigned char *srcBuf, + int pad, int subsamp, unsigned char *dstBuf, + int width, int pitch, int height, int pixelFormat, + int flags); + + +/** + * Decode a set of Y, U (Cb), and V (Cr) image planes into an RGB or grayscale + * image. This function uses the accelerated color conversion routines in the + * underlying codec but does not execute any of the other steps in the JPEG + * decompression process. + * + * @param handle a handle to a TurboJPEG decompressor or transformer instance + * + * @param srcPlanes an array of pointers to Y, U (Cb), and V (Cr) image planes + * (or just a Y plane, if decoding a grayscale image) that contain a YUV image + * to be decoded. These planes can be contiguous or non-contiguous in memory. + * The size of each plane should match the value returned by #tjPlaneSizeYUV() + * for the given image width, height, strides, and level of chrominance + * subsampling. Refer to @ref YUVnotes "YUV Image Format Notes" for more + * details. + * + * @param strides an array of integers, each specifying the number of bytes per + * line in the corresponding plane of the YUV source image. Setting the stride + * for any plane to 0 is the same as setting it to the plane width (see + * @ref YUVnotes "YUV Image Format Notes".) If strides is NULL, then + * the strides for all planes will be set to their respective plane widths. + * You can adjust the strides in order to specify an arbitrary amount of line + * padding in each plane or to decode a subregion of a larger YUV planar image. + * + * @param subsamp the level of chrominance subsampling used in the YUV source + * image (see @ref TJSAMP "Chrominance subsampling options".) + * + * @param dstBuf pointer to an image buffer that will receive the decoded + * image. This buffer should normally be pitch * height bytes in + * size, but the dstBuf pointer can also be used to decode into a + * specific region of a larger buffer. + * + * @param width width (in pixels) of the source and destination images + * + * @param pitch bytes per line in the destination image. Normally, this should + * be width * #tjPixelSize[pixelFormat] if the destination image is + * unpadded, or #TJPAD(width * #tjPixelSize[pixelFormat]) if each line + * of the destination image should be padded to the nearest 32-bit boundary, as + * is the case for Windows bitmaps. You can also be clever and use the pitch + * parameter to skip lines, etc. Setting this parameter to 0 is the equivalent + * of setting it to width * #tjPixelSize[pixelFormat]. + * + * @param height height (in pixels) of the source and destination images + * + * @param pixelFormat pixel format of the destination image (see @ref TJPF + * "Pixel formats".) + * + * @param flags the bitwise OR of one or more of the @ref TJFLAG_ACCURATEDCT + * "flags" + * + * @return 0 if successful, or -1 if an error occurred (see #tjGetErrorStr2() + * and #tjGetErrorCode().) + */ +DLLEXPORT int tjDecodeYUVPlanes(tjhandle handle, + const unsigned char **srcPlanes, + const int *strides, int subsamp, + unsigned char *dstBuf, int width, int pitch, + int height, int pixelFormat, int flags); + + +/** + * Create a new TurboJPEG transformer instance. + * + * @return a handle to the newly-created instance, or NULL if an error + * occurred (see #tjGetErrorStr2().) + */ +DLLEXPORT tjhandle tjInitTransform(void); + + +/** + * Losslessly transform a JPEG image into another JPEG image. Lossless + * transforms work by moving the raw DCT coefficients from one JPEG image + * structure to another without altering the values of the coefficients. While + * this is typically faster than decompressing the image, transforming it, and + * re-compressing it, lossless transforms are not free. Each lossless + * transform requires reading and performing Huffman decoding on all of the + * coefficients in the source image, regardless of the size of the destination + * image. Thus, this function provides a means of generating multiple + * transformed images from the same source or applying multiple + * transformations simultaneously, in order to eliminate the need to read the + * source coefficients multiple times. + * + * @param handle a handle to a TurboJPEG transformer instance + * + * @param jpegBuf pointer to a buffer containing the JPEG source image to + * transform + * + * @param jpegSize size of the JPEG source image (in bytes) + * + * @param n the number of transformed JPEG images to generate + * + * @param dstBufs pointer to an array of n image buffers. dstBufs[i] + * will receive a JPEG image that has been transformed using the parameters in + * transforms[i]. TurboJPEG has the ability to reallocate the JPEG + * buffer to accommodate the size of the JPEG image. Thus, you can choose to: + * -# pre-allocate the JPEG buffer with an arbitrary size using #tjAlloc() and + * let TurboJPEG grow the buffer as needed, + * -# set dstBufs[i] to NULL to tell TurboJPEG to allocate the buffer + * for you, or + * -# pre-allocate the buffer to a "worst case" size determined by calling + * #tjBufSize() with the transformed or cropped width and height. Under normal + * circumstances, this should ensure that the buffer never has to be + * re-allocated (setting #TJFLAG_NOREALLOC guarantees that it won't be.) Note, + * however, that there are some rare cases (such as transforming images with a + * large amount of embedded EXIF or ICC profile data) in which the output image + * will be larger than the worst-case size, and #TJFLAG_NOREALLOC cannot be + * used in those cases. + * . + * If you choose option 1, dstSizes[i] should be set to the size of + * your pre-allocated buffer. In any case, unless you have set + * #TJFLAG_NOREALLOC, you should always check dstBufs[i] upon return + * from this function, as it may have changed. + * + * @param dstSizes pointer to an array of n unsigned long variables that will + * receive the actual sizes (in bytes) of each transformed JPEG image. If + * dstBufs[i] points to a pre-allocated buffer, then + * dstSizes[i] should be set to the size of the buffer. Upon return, + * dstSizes[i] will contain the size of the JPEG image (in bytes.) + * + * @param transforms pointer to an array of n #tjtransform structures, each of + * which specifies the transform parameters and/or cropping region for the + * corresponding transformed output image. + * + * @param flags the bitwise OR of one or more of the @ref TJFLAG_ACCURATEDCT + * "flags" + * + * @return 0 if successful, or -1 if an error occurred (see #tjGetErrorStr2() + * and #tjGetErrorCode().) + */ +DLLEXPORT int tjTransform(tjhandle handle, const unsigned char *jpegBuf, + unsigned long jpegSize, int n, + unsigned char **dstBufs, unsigned long *dstSizes, + tjtransform *transforms, int flags); + + +/** + * Destroy a TurboJPEG compressor, decompressor, or transformer instance. + * + * @param handle a handle to a TurboJPEG compressor, decompressor or + * transformer instance + * + * @return 0 if successful, or -1 if an error occurred (see #tjGetErrorStr2().) + */ +DLLEXPORT int tjDestroy(tjhandle handle); + + +/** + * Allocate an image buffer for use with TurboJPEG. You should always use + * this function to allocate the JPEG destination buffer(s) for the compression + * and transform functions unless you are disabling automatic buffer + * (re)allocation (by setting #TJFLAG_NOREALLOC.) + * + * @param bytes the number of bytes to allocate + * + * @return a pointer to a newly-allocated buffer with the specified number of + * bytes. + * + * @sa tjFree() + */ +DLLEXPORT unsigned char *tjAlloc(int bytes); + + +/** + * Load an uncompressed image from disk into memory. + * + * @param filename name of a file containing an uncompressed image in Windows + * BMP or PBMPLUS (PPM/PGM) format + * + * @param width pointer to an integer variable that will receive the width (in + * pixels) of the uncompressed image + * + * @param align row alignment of the image buffer to be returned (must be a + * power of 2.) For instance, setting this parameter to 4 will cause all rows + * in the image buffer to be padded to the nearest 32-bit boundary, and setting + * this parameter to 1 will cause all rows in the image buffer to be unpadded. + * + * @param height pointer to an integer variable that will receive the height + * (in pixels) of the uncompressed image + * + * @param pixelFormat pointer to an integer variable that specifies or will + * receive the pixel format of the uncompressed image buffer. The behavior of + * #tjLoadImage() will vary depending on the value of *pixelFormat + * passed to the function: + * - @ref TJPF_UNKNOWN : The uncompressed image buffer returned by the function + * will use the most optimal pixel format for the file type, and + * *pixelFormat will contain the ID of this pixel format upon + * successful return from the function. + * - @ref TJPF_GRAY : Only PGM files and 8-bit BMP files with a grayscale + * colormap can be loaded. + * - @ref TJPF_CMYK : The RGB or grayscale pixels stored in the file will be + * converted using a quick & dirty algorithm that is suitable only for testing + * purposes (proper conversion between CMYK and other formats requires a color + * management system.) + * - Other @ref TJPF "pixel formats" : The uncompressed image buffer will use + * the specified pixel format, and pixel format conversion will be performed if + * necessary. + * + * @param flags the bitwise OR of one or more of the @ref TJFLAG_BOTTOMUP + * "flags". + * + * @return a pointer to a newly-allocated buffer containing the uncompressed + * image, converted to the chosen pixel format and with the chosen row + * alignment, or NULL if an error occurred (see #tjGetErrorStr2().) This + * buffer should be freed using #tjFree(). + */ +DLLEXPORT unsigned char *tjLoadImage(const char *filename, int *width, + int align, int *height, int *pixelFormat, + int flags); + + +/** + * Save an uncompressed image from memory to disk. + * + * @param filename name of a file to which to save the uncompressed image. + * The image will be stored in Windows BMP or PBMPLUS (PPM/PGM) format, + * depending on the file extension. + * + * @param buffer pointer to an image buffer containing RGB, grayscale, or + * CMYK pixels to be saved + * + * @param width width (in pixels) of the uncompressed image + * + * @param pitch bytes per line in the image buffer. Setting this parameter to + * 0 is the equivalent of setting it to + * width * #tjPixelSize[pixelFormat]. + * + * @param height height (in pixels) of the uncompressed image + * + * @param pixelFormat pixel format of the image buffer (see @ref TJPF + * "Pixel formats".) If this parameter is set to @ref TJPF_GRAY, then the + * image will be stored in PGM or 8-bit (indexed color) BMP format. Otherwise, + * the image will be stored in PPM or 24-bit BMP format. If this parameter + * is set to @ref TJPF_CMYK, then the CMYK pixels will be converted to RGB + * using a quick & dirty algorithm that is suitable only for testing (proper + * conversion between CMYK and other formats requires a color management + * system.) + * + * @param flags the bitwise OR of one or more of the @ref TJFLAG_BOTTOMUP + * "flags". + * + * @return 0 if successful, or -1 if an error occurred (see #tjGetErrorStr2().) + */ +DLLEXPORT int tjSaveImage(const char *filename, unsigned char *buffer, + int width, int pitch, int height, int pixelFormat, + int flags); + + +/** + * Free an image buffer previously allocated by TurboJPEG. You should always + * use this function to free JPEG destination buffer(s) that were automatically + * (re)allocated by the compression and transform functions or that were + * manually allocated using #tjAlloc(). + * + * @param buffer address of the buffer to free + * + * @sa tjAlloc() + */ +DLLEXPORT void tjFree(unsigned char *buffer); + + +/** + * Returns a descriptive error message explaining why the last command failed. + * + * @param handle a handle to a TurboJPEG compressor, decompressor, or + * transformer instance, or NULL if the error was generated by a global + * function (but note that retrieving the error message for a global function + * is not thread-safe.) + * + * @return a descriptive error message explaining why the last command failed. + */ +DLLEXPORT char *tjGetErrorStr2(tjhandle handle); + + +/** + * Returns a code indicating the severity of the last error. See + * @ref TJERR "Error codes". + * + * @param handle a handle to a TurboJPEG compressor, decompressor or + * transformer instance + * + * @return a code indicating the severity of the last error. See + * @ref TJERR "Error codes". + */ +DLLEXPORT int tjGetErrorCode(tjhandle handle); + + +/* Deprecated functions and macros */ +#define TJFLAG_FORCEMMX 8 +#define TJFLAG_FORCESSE 16 +#define TJFLAG_FORCESSE2 32 +#define TJFLAG_FORCESSE3 128 + + +/* Backward compatibility functions and macros (nothing to see here) */ +#define NUMSUBOPT TJ_NUMSAMP +#define TJ_444 TJSAMP_444 +#define TJ_422 TJSAMP_422 +#define TJ_420 TJSAMP_420 +#define TJ_411 TJSAMP_420 +#define TJ_GRAYSCALE TJSAMP_GRAY + +#define TJ_BGR 1 +#define TJ_BOTTOMUP TJFLAG_BOTTOMUP +#define TJ_FORCEMMX TJFLAG_FORCEMMX +#define TJ_FORCESSE TJFLAG_FORCESSE +#define TJ_FORCESSE2 TJFLAG_FORCESSE2 +#define TJ_ALPHAFIRST 64 +#define TJ_FORCESSE3 TJFLAG_FORCESSE3 +#define TJ_FASTUPSAMPLE TJFLAG_FASTUPSAMPLE +#define TJ_YUV 512 + +DLLEXPORT unsigned long TJBUFSIZE(int width, int height); + +DLLEXPORT unsigned long TJBUFSIZEYUV(int width, int height, int jpegSubsamp); + +DLLEXPORT unsigned long tjBufSizeYUV(int width, int height, int subsamp); + +DLLEXPORT int tjCompress(tjhandle handle, unsigned char *srcBuf, int width, + int pitch, int height, int pixelSize, + unsigned char *dstBuf, unsigned long *compressedSize, + int jpegSubsamp, int jpegQual, int flags); + +DLLEXPORT int tjEncodeYUV(tjhandle handle, unsigned char *srcBuf, int width, + int pitch, int height, int pixelSize, + unsigned char *dstBuf, int subsamp, int flags); + +DLLEXPORT int tjEncodeYUV2(tjhandle handle, unsigned char *srcBuf, int width, + int pitch, int height, int pixelFormat, + unsigned char *dstBuf, int subsamp, int flags); + +DLLEXPORT int tjDecompressHeader(tjhandle handle, unsigned char *jpegBuf, + unsigned long jpegSize, int *width, + int *height); + +DLLEXPORT int tjDecompressHeader2(tjhandle handle, unsigned char *jpegBuf, + unsigned long jpegSize, int *width, + int *height, int *jpegSubsamp); + +DLLEXPORT int tjDecompress(tjhandle handle, unsigned char *jpegBuf, + unsigned long jpegSize, unsigned char *dstBuf, + int width, int pitch, int height, int pixelSize, + int flags); + +DLLEXPORT int tjDecompressToYUV(tjhandle handle, unsigned char *jpegBuf, + unsigned long jpegSize, unsigned char *dstBuf, + int flags); + +DLLEXPORT char *tjGetErrorStr(void); + + +/** + * @} + */ + +#ifdef __cplusplus +} +#endif + +#endif