Various fixes

This commit is contained in:
Ilya Laktyushin 2023-01-18 16:11:11 +04:00
parent b26479f9f3
commit 86ee12c1c8
26 changed files with 468 additions and 240 deletions

View File

@ -1,6 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?>
<document type="com.apple.InterfaceBuilder3.CocoaTouch.XIB" version="3.0" toolsVersion="21507" targetRuntime="iOS.CocoaTouch" propertyAccessControl="none" useAutolayout="YES" launchScreen="YES" useTraitCollections="YES" colorMatched="YES">
<device id="retina6_1" orientation="portrait" appearance="light"/>
<device id="retina4_7" orientation="portrait" appearance="light"/>
<dependencies>
<plugIn identifier="com.apple.InterfaceBuilder.IBCocoaTouchPlugin" version="21505"/>
<capability name="System colors in document resources" minToolsVersion="11.0"/>
@ -10,14 +10,14 @@
<placeholder placeholderIdentifier="IBFilesOwner" id="-1" userLabel="File's Owner"/>
<placeholder placeholderIdentifier="IBFirstResponder" id="-2" customClass="UIResponder"/>
<view contentMode="scaleToFill" id="O8c-13-3vw">
<rect key="frame" x="0.0" y="0.0" width="414" height="896"/>
<rect key="frame" x="0.0" y="0.0" width="375" height="667"/>
<autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMaxY="YES"/>
<subviews>
<imageView clipsSubviews="YES" userInteractionEnabled="NO" contentMode="scaleAspectFit" horizontalHuggingPriority="251" verticalHuggingPriority="251" image="Chat/Links/QrLogo" translatesAutoresizingMaskIntoConstraints="NO" id="Ra6-Gz-QsF">
<rect key="frame" x="147" y="388" width="120" height="120"/>
<imageView clipsSubviews="YES" userInteractionEnabled="NO" contentMode="scaleAspectFit" horizontalHuggingPriority="251" verticalHuggingPriority="251" image="Components/LaunchLogo" translatesAutoresizingMaskIntoConstraints="NO" id="Ra6-Gz-QsF">
<rect key="frame" x="138" y="284" width="99" height="99"/>
<constraints>
<constraint firstAttribute="width" constant="120" id="Mhj-0F-KYG"/>
<constraint firstAttribute="height" constant="120" id="gdP-J3-bQE"/>
<constraint firstAttribute="width" constant="99" id="Mhj-0F-KYG"/>
<constraint firstAttribute="height" constant="99" id="gdP-J3-bQE"/>
</constraints>
</imageView>
</subviews>
@ -30,7 +30,7 @@
</view>
</objects>
<resources>
<image name="Chat/Links/QrLogo" width="72" height="72"/>
<image name="Components/LaunchLogo" width="99" height="99"/>
<systemColor name="systemBackgroundColor">
<color white="1" alpha="1" colorSpace="custom" customColorSpace="genericGamma22GrayColorSpace"/>
</systemColor>

Binary file not shown.

Before

Width:  |  Height:  |  Size: 8.9 KiB

After

Width:  |  Height:  |  Size: 7.7 KiB

View File

@ -414,7 +414,7 @@ final class AuthorizationSequenceCodeEntryControllerNode: ASDisplayNode, UITextF
prefix: codePrefix,
count: codeLength,
width: maximumWidth - 28.0,
compact: layout.size.width <= 320.0
compact: layout.size.width <= 320.0 || (layout.size.width <= 375.0 && codeLength > 5)
)
var items: [AuthorizationLayoutItem] = []

View File

@ -968,7 +968,12 @@ final class PhoneConfirmationController: ViewController {
if case .regular = layout.metrics.widthClass {
originY = floorToScreenPixels((layout.size.height - backgroundSize.height) / 2.0)
} else {
let hasOnScreenNavigation = layout.deviceMetrics.onScreenNavigationHeight(inLandscape: false, systemOnScreenNavigationHeight: nil) != nil
if hasOnScreenNavigation || layout.deviceMetrics.hasTopNotch || layout.deviceMetrics.hasDynamicIsland {
originY = layout.size.height - backgroundSize.height - 260.0
} else {
originY = floorToScreenPixels((layout.size.height - backgroundSize.height) / 2.0)
}
}
let backgroundFrame = CGRect(origin: CGPoint(x: floorToScreenPixels((layout.size.width - backgroundSize.width) / 2.0), y: originY), size: backgroundSize)

View File

@ -2131,12 +2131,20 @@ public class ChatListControllerImpl: TelegramBaseController, ChatListController
}
@objc fileprivate func reorderingDonePressed() {
if !self.chatListDisplayNode.isReorderingFilters {
guard let defaultFilters = self.tabContainerData else {
return
}
let defaultFilterIds = defaultFilters.0.compactMap { entry -> Int32? in
switch entry {
case .all:
return 0
case let .filter(id, _, _):
return id
}
}
var reorderedFilterIdsValue: [Int32]?
if let reorderedFilterIds = self.tabContainerNode.reorderedFilterIds {
if let reorderedFilterIds = self.tabContainerNode.reorderedFilterIds, reorderedFilterIds != defaultFilterIds {
reorderedFilterIdsValue = reorderedFilterIds
}

View File

@ -8,15 +8,15 @@ public final class TextFieldNodeView: UITextField {
var fixOffset: Bool = true
override public func editingRect(forBounds bounds: CGRect) -> CGRect {
return bounds.offsetBy(dx: 0.0, dy: 0.0).integral
return bounds.integral
}
override public func textRect(forBounds bounds: CGRect) -> CGRect {
return bounds.offsetBy(dx: 0.0, dy: 0.0).integral
return bounds.integral
}
override public func placeholderRect(forBounds bounds: CGRect) -> CGRect {
return self.editingRect(forBounds: bounds.offsetBy(dx: 0.0, dy: 0.0))
return self.editingRect(forBounds: bounds)
}
override public func deleteBackward() {

View File

@ -48,7 +48,7 @@ public final class DrawingStickerEntity: DrawingEntity, Codable {
public var isAnimated: Bool {
switch self.content {
case let .file(file):
return file.isAnimatedSticker || file.isVideoSticker
return file.isAnimatedSticker || file.isVideoSticker || file.mimeType == "video/webm"
case .image:
return false
}

View File

@ -318,11 +318,24 @@ class StickerPickerScreen: ViewController {
guard let strongSelf = self, let controller = strongSelf.controller else {
return
}
if groupId == AnyHashable("popular") {
let presentationData = controller.context.sharedContext.currentPresentationData.with { $0 }.withUpdated(theme: defaultDarkColorPresentationTheme)
let context = controller.context
if groupId == AnyHashable("recent") {
let actionSheet = ActionSheetController(theme: ActionSheetControllerTheme(presentationTheme: presentationData.theme, fontSize: presentationData.listsFontSize))
var items: [ActionSheetItem] = []
items.append(ActionSheetButtonItem(title: presentationData.strings.Emoji_ClearRecent, color: .destructive, action: { [weak actionSheet] in
actionSheet?.dismissAnimated()
let _ = context.engine.stickers.clearRecentlyUsedEmoji().start()
}))
actionSheet.setItemGroups([ActionSheetItemGroup(items: items), ActionSheetItemGroup(items: [
ActionSheetButtonItem(title: presentationData.strings.Common_Cancel, color: .accent, font: .bold, action: { [weak actionSheet] in
actionSheet?.dismissAnimated()
})
])])
context.sharedContext.mainWindow?.presentInGlobalOverlay(actionSheet)
} else if groupId == AnyHashable("popular") {
let actionSheet = ActionSheetController(theme: ActionSheetControllerTheme(presentationTheme: presentationData.theme, fontSize: presentationData.listsFontSize))
var items: [ActionSheetItem] = []
let context = controller.context
items.append(ActionSheetTextItem(title: presentationData.strings.Chat_ClearReactionsAlertText, parseMarkdown: true))
items.append(ActionSheetButtonItem(title: presentationData.strings.Chat_ClearReactionsAlertAction, color: .destructive, action: { [weak actionSheet] in
actionSheet?.dismissAnimated()

View File

@ -101,7 +101,7 @@ private class LegacyPaintStickerEntity: LegacyPaintEntity {
case let .file(file):
self.file = file
if file.isAnimatedSticker || file.isVideoSticker || file.mimeType == "video/webm" {
self.source = AnimatedStickerResourceSource(account: account, resource: file.resource, isVideo: file.isVideoSticker)
self.source = AnimatedStickerResourceSource(account: account, resource: file.resource, isVideo: file.isVideoSticker || file.mimeType == "video/webm")
if let source = self.source {
let dimensions = file.dimensions ?? PixelDimensions(width: 512, height: 512)
let fittedDimensions = dimensions.cgSize.aspectFitted(CGSize(width: 384, height: 384))
@ -406,10 +406,13 @@ public final class LegacyPaintEntityRenderer: NSObject, TGPhotoPaintEntityRender
private let originalSize: CGSize
private let cropRect: CGRect?
private let isAvatar: Bool
public init(account: Account?, adjustments: TGMediaEditAdjustments) {
self.account = account
self.originalSize = adjustments.originalSize
self.cropRect = adjustments.cropRect.isEmpty ? nil : adjustments.cropRect
self.isAvatar = ((adjustments as? TGVideoEditAdjustments)?.documentId ?? 0) != 0
var renderEntities: [LegacyPaintEntity] = []
if let account = account, let paintingData = adjustments.paintingData, let entitiesData = paintingData.entitiesData {
@ -477,7 +480,7 @@ public final class LegacyPaintEntityRenderer: NSObject, TGPhotoPaintEntityRender
} else {
result = minDuration
}
if result < minDuration {
if result < minDuration && !self.isAvatar {
if result > 0 {
result = result * ceil(minDuration / result)
} else {

View File

@ -198,7 +198,6 @@ public final class PhoneInputNode: ASDisplayNode, UITextFieldDelegate {
self.countryCodeField.textField.returnKeyType = .next
if #available(iOSApplicationExtension 10.0, iOS 10.0, *) {
self.countryCodeField.textField.keyboardType = .asciiCapableNumberPad
// self.countryCodeField.textField.textContentType = .telephoneNumber
} else {
self.countryCodeField.textField.keyboardType = .numberPad
}
@ -209,7 +208,6 @@ public final class PhoneInputNode: ASDisplayNode, UITextFieldDelegate {
self.numberField.textField.font = font
if #available(iOSApplicationExtension 10.0, iOS 10.0, *) {
self.numberField.textField.keyboardType = .asciiCapableNumberPad
// self.numberField.textField.textContentType = .telephoneNumber
} else {
self.numberField.textField.keyboardType = .numberPad
}

View File

@ -243,7 +243,7 @@ typedef enum {
CGPoint buttonTargetPosition = _startButton.center;
_startButton.center = CGPointMake(buttonTargetPosition.x, buttonTargetPosition.y + 220.0);
_glkView.transform = CGAffineTransformMakeScale(0.68, 0.68);
_glkView.transform = CGAffineTransformMakeScale(0.66, 0.66);
[UIView animateWithDuration:0.65 delay:0.15 usingSpringWithDamping:1.2f initialSpringVelocity:0.0 options:kNilOptions animations:^{
_glkView.center = logoTargetPosition;

View File

@ -207,6 +207,7 @@ fileprivate let parsers: [Int32 : (BufferReader) -> Any?] = {
dict[1383932651] = { return Api.EmailVerifyPurpose.parse_emailVerifyPurposeLoginChange($0) }
dict[1128644211] = { return Api.EmailVerifyPurpose.parse_emailVerifyPurposeLoginSetup($0) }
dict[-1141565819] = { return Api.EmailVerifyPurpose.parse_emailVerifyPurposePassport($0) }
dict[2056961449] = { return Api.EmojiGroup.parse_emojiGroup($0) }
dict[-709641735] = { return Api.EmojiKeyword.parse_emojiKeyword($0) }
dict[594408994] = { return Api.EmojiKeyword.parse_emojiKeywordDeleted($0) }
dict[1556570557] = { return Api.EmojiKeywordsDifference.parse_emojiKeywordsDifference($0) }
@ -1031,6 +1032,8 @@ fileprivate let parsers: [Int32 : (BufferReader) -> Any?] = {
dict[-253500010] = { return Api.messages.Dialogs.parse_dialogsNotModified($0) }
dict[1910543603] = { return Api.messages.Dialogs.parse_dialogsSlice($0) }
dict[-1506535550] = { return Api.messages.DiscussionMessage.parse_discussionMessage($0) }
dict[-2011186869] = { return Api.messages.EmojiGroups.parse_emojiGroups($0) }
dict[1874111879] = { return Api.messages.EmojiGroups.parse_emojiGroupsNotModified($0) }
dict[410107472] = { return Api.messages.ExportedChatInvite.parse_exportedChatInvite($0) }
dict[572915951] = { return Api.messages.ExportedChatInvite.parse_exportedChatInviteReplaced($0) }
dict[-1111085620] = { return Api.messages.ExportedChatInvites.parse_exportedChatInvites($0) }
@ -1295,6 +1298,8 @@ public extension Api {
_1.serialize(buffer, boxed)
case let _1 as Api.EmailVerifyPurpose:
_1.serialize(buffer, boxed)
case let _1 as Api.EmojiGroup:
_1.serialize(buffer, boxed)
case let _1 as Api.EmojiKeyword:
_1.serialize(buffer, boxed)
case let _1 as Api.EmojiKeywordsDifference:
@ -1823,6 +1828,8 @@ public extension Api {
_1.serialize(buffer, boxed)
case let _1 as Api.messages.DiscussionMessage:
_1.serialize(buffer, boxed)
case let _1 as Api.messages.EmojiGroups:
_1.serialize(buffer, boxed)
case let _1 as Api.messages.ExportedChatInvite:
_1.serialize(buffer, boxed)
case let _1 as Api.messages.ExportedChatInvites:

View File

@ -800,6 +800,64 @@ public extension Api.messages {
}
}
public extension Api.messages {
enum EmojiGroups: TypeConstructorDescription {
case emojiGroups(hash: Int32, groups: [Api.EmojiGroup])
case emojiGroupsNotModified
public func serialize(_ buffer: Buffer, _ boxed: Swift.Bool) {
switch self {
case .emojiGroups(let hash, let groups):
if boxed {
buffer.appendInt32(-2011186869)
}
serializeInt32(hash, buffer: buffer, boxed: false)
buffer.appendInt32(481674261)
buffer.appendInt32(Int32(groups.count))
for item in groups {
item.serialize(buffer, true)
}
break
case .emojiGroupsNotModified:
if boxed {
buffer.appendInt32(1874111879)
}
break
}
}
public func descriptionFields() -> (String, [(String, Any)]) {
switch self {
case .emojiGroups(let hash, let groups):
return ("emojiGroups", [("hash", hash as Any), ("groups", groups as Any)])
case .emojiGroupsNotModified:
return ("emojiGroupsNotModified", [])
}
}
public static func parse_emojiGroups(_ reader: BufferReader) -> EmojiGroups? {
var _1: Int32?
_1 = reader.readInt32()
var _2: [Api.EmojiGroup]?
if let _ = reader.readInt32() {
_2 = Api.parseVector(reader, elementSignature: 0, elementType: Api.EmojiGroup.self)
}
let _c1 = _1 != nil
let _c2 = _2 != nil
if _c1 && _c2 {
return Api.messages.EmojiGroups.emojiGroups(hash: _1!, groups: _2!)
}
else {
return nil
}
}
public static func parse_emojiGroupsNotModified(_ reader: BufferReader) -> EmojiGroups? {
return Api.messages.EmojiGroups.emojiGroupsNotModified
}
}
}
public extension Api.messages {
enum ExportedChatInvite: TypeConstructorDescription {
case exportedChatInvite(invite: Api.ExportedChatInvite, users: [Api.User])
@ -1364,101 +1422,3 @@ public extension Api.messages {
}
}
public extension Api.messages {
enum InactiveChats: TypeConstructorDescription {
case inactiveChats(dates: [Int32], chats: [Api.Chat], users: [Api.User])
public func serialize(_ buffer: Buffer, _ boxed: Swift.Bool) {
switch self {
case .inactiveChats(let dates, let chats, let users):
if boxed {
buffer.appendInt32(-1456996667)
}
buffer.appendInt32(481674261)
buffer.appendInt32(Int32(dates.count))
for item in dates {
serializeInt32(item, buffer: buffer, boxed: false)
}
buffer.appendInt32(481674261)
buffer.appendInt32(Int32(chats.count))
for item in chats {
item.serialize(buffer, true)
}
buffer.appendInt32(481674261)
buffer.appendInt32(Int32(users.count))
for item in users {
item.serialize(buffer, true)
}
break
}
}
public func descriptionFields() -> (String, [(String, Any)]) {
switch self {
case .inactiveChats(let dates, let chats, let users):
return ("inactiveChats", [("dates", dates as Any), ("chats", chats as Any), ("users", users as Any)])
}
}
public static func parse_inactiveChats(_ reader: BufferReader) -> InactiveChats? {
var _1: [Int32]?
if let _ = reader.readInt32() {
_1 = Api.parseVector(reader, elementSignature: -1471112230, elementType: Int32.self)
}
var _2: [Api.Chat]?
if let _ = reader.readInt32() {
_2 = Api.parseVector(reader, elementSignature: 0, elementType: Api.Chat.self)
}
var _3: [Api.User]?
if let _ = reader.readInt32() {
_3 = Api.parseVector(reader, elementSignature: 0, elementType: Api.User.self)
}
let _c1 = _1 != nil
let _c2 = _2 != nil
let _c3 = _3 != nil
if _c1 && _c2 && _c3 {
return Api.messages.InactiveChats.inactiveChats(dates: _1!, chats: _2!, users: _3!)
}
else {
return nil
}
}
}
}
public extension Api.messages {
enum MessageEditData: TypeConstructorDescription {
case messageEditData(flags: Int32)
public func serialize(_ buffer: Buffer, _ boxed: Swift.Bool) {
switch self {
case .messageEditData(let flags):
if boxed {
buffer.appendInt32(649453030)
}
serializeInt32(flags, buffer: buffer, boxed: false)
break
}
}
public func descriptionFields() -> (String, [(String, Any)]) {
switch self {
case .messageEditData(let flags):
return ("messageEditData", [("flags", flags as Any)])
}
}
public static func parse_messageEditData(_ reader: BufferReader) -> MessageEditData? {
var _1: Int32?
_1 = reader.readInt32()
let _c1 = _1 != nil
if _c1 {
return Api.messages.MessageEditData.messageEditData(flags: _1!)
}
else {
return nil
}
}
}
}

View File

@ -1,3 +1,101 @@
public extension Api.messages {
enum InactiveChats: TypeConstructorDescription {
case inactiveChats(dates: [Int32], chats: [Api.Chat], users: [Api.User])
public func serialize(_ buffer: Buffer, _ boxed: Swift.Bool) {
switch self {
case .inactiveChats(let dates, let chats, let users):
if boxed {
buffer.appendInt32(-1456996667)
}
buffer.appendInt32(481674261)
buffer.appendInt32(Int32(dates.count))
for item in dates {
serializeInt32(item, buffer: buffer, boxed: false)
}
buffer.appendInt32(481674261)
buffer.appendInt32(Int32(chats.count))
for item in chats {
item.serialize(buffer, true)
}
buffer.appendInt32(481674261)
buffer.appendInt32(Int32(users.count))
for item in users {
item.serialize(buffer, true)
}
break
}
}
public func descriptionFields() -> (String, [(String, Any)]) {
switch self {
case .inactiveChats(let dates, let chats, let users):
return ("inactiveChats", [("dates", dates as Any), ("chats", chats as Any), ("users", users as Any)])
}
}
public static func parse_inactiveChats(_ reader: BufferReader) -> InactiveChats? {
var _1: [Int32]?
if let _ = reader.readInt32() {
_1 = Api.parseVector(reader, elementSignature: -1471112230, elementType: Int32.self)
}
var _2: [Api.Chat]?
if let _ = reader.readInt32() {
_2 = Api.parseVector(reader, elementSignature: 0, elementType: Api.Chat.self)
}
var _3: [Api.User]?
if let _ = reader.readInt32() {
_3 = Api.parseVector(reader, elementSignature: 0, elementType: Api.User.self)
}
let _c1 = _1 != nil
let _c2 = _2 != nil
let _c3 = _3 != nil
if _c1 && _c2 && _c3 {
return Api.messages.InactiveChats.inactiveChats(dates: _1!, chats: _2!, users: _3!)
}
else {
return nil
}
}
}
}
public extension Api.messages {
enum MessageEditData: TypeConstructorDescription {
case messageEditData(flags: Int32)
public func serialize(_ buffer: Buffer, _ boxed: Swift.Bool) {
switch self {
case .messageEditData(let flags):
if boxed {
buffer.appendInt32(649453030)
}
serializeInt32(flags, buffer: buffer, boxed: false)
break
}
}
public func descriptionFields() -> (String, [(String, Any)]) {
switch self {
case .messageEditData(let flags):
return ("messageEditData", [("flags", flags as Any)])
}
}
public static func parse_messageEditData(_ reader: BufferReader) -> MessageEditData? {
var _1: Int32?
_1 = reader.readInt32()
let _c1 = _1 != nil
if _c1 {
return Api.messages.MessageEditData.messageEditData(flags: _1!)
}
else {
return nil
}
}
}
}
public extension Api.messages {
enum MessageReactionsList: TypeConstructorDescription {
case messageReactionsList(flags: Int32, count: Int32, reactions: [Api.MessagePeerReaction], chats: [Api.Chat], users: [Api.User], nextOffset: String?)
@ -1318,67 +1416,3 @@ public extension Api.messages {
}
}
public extension Api.messages {
enum VotesList: TypeConstructorDescription {
case votesList(flags: Int32, count: Int32, votes: [Api.MessageUserVote], users: [Api.User], nextOffset: String?)
public func serialize(_ buffer: Buffer, _ boxed: Swift.Bool) {
switch self {
case .votesList(let flags, let count, let votes, let users, let nextOffset):
if boxed {
buffer.appendInt32(136574537)
}
serializeInt32(flags, buffer: buffer, boxed: false)
serializeInt32(count, buffer: buffer, boxed: false)
buffer.appendInt32(481674261)
buffer.appendInt32(Int32(votes.count))
for item in votes {
item.serialize(buffer, true)
}
buffer.appendInt32(481674261)
buffer.appendInt32(Int32(users.count))
for item in users {
item.serialize(buffer, true)
}
if Int(flags) & Int(1 << 0) != 0 {serializeString(nextOffset!, buffer: buffer, boxed: false)}
break
}
}
public func descriptionFields() -> (String, [(String, Any)]) {
switch self {
case .votesList(let flags, let count, let votes, let users, let nextOffset):
return ("votesList", [("flags", flags as Any), ("count", count as Any), ("votes", votes as Any), ("users", users as Any), ("nextOffset", nextOffset as Any)])
}
}
public static func parse_votesList(_ reader: BufferReader) -> VotesList? {
var _1: Int32?
_1 = reader.readInt32()
var _2: Int32?
_2 = reader.readInt32()
var _3: [Api.MessageUserVote]?
if let _ = reader.readInt32() {
_3 = Api.parseVector(reader, elementSignature: 0, elementType: Api.MessageUserVote.self)
}
var _4: [Api.User]?
if let _ = reader.readInt32() {
_4 = Api.parseVector(reader, elementSignature: 0, elementType: Api.User.self)
}
var _5: String?
if Int(_1!) & Int(1 << 0) != 0 {_5 = parseString(reader) }
let _c1 = _1 != nil
let _c2 = _2 != nil
let _c3 = _3 != nil
let _c4 = _4 != nil
let _c5 = (Int(_1!) & Int(1 << 0) == 0) || _5 != nil
if _c1 && _c2 && _c3 && _c4 && _c5 {
return Api.messages.VotesList.votesList(flags: _1!, count: _2!, votes: _3!, users: _4!, nextOffset: _5)
}
else {
return nil
}
}
}
}

View File

@ -1,3 +1,67 @@
public extension Api.messages {
enum VotesList: TypeConstructorDescription {
case votesList(flags: Int32, count: Int32, votes: [Api.MessageUserVote], users: [Api.User], nextOffset: String?)
public func serialize(_ buffer: Buffer, _ boxed: Swift.Bool) {
switch self {
case .votesList(let flags, let count, let votes, let users, let nextOffset):
if boxed {
buffer.appendInt32(136574537)
}
serializeInt32(flags, buffer: buffer, boxed: false)
serializeInt32(count, buffer: buffer, boxed: false)
buffer.appendInt32(481674261)
buffer.appendInt32(Int32(votes.count))
for item in votes {
item.serialize(buffer, true)
}
buffer.appendInt32(481674261)
buffer.appendInt32(Int32(users.count))
for item in users {
item.serialize(buffer, true)
}
if Int(flags) & Int(1 << 0) != 0 {serializeString(nextOffset!, buffer: buffer, boxed: false)}
break
}
}
public func descriptionFields() -> (String, [(String, Any)]) {
switch self {
case .votesList(let flags, let count, let votes, let users, let nextOffset):
return ("votesList", [("flags", flags as Any), ("count", count as Any), ("votes", votes as Any), ("users", users as Any), ("nextOffset", nextOffset as Any)])
}
}
public static func parse_votesList(_ reader: BufferReader) -> VotesList? {
var _1: Int32?
_1 = reader.readInt32()
var _2: Int32?
_2 = reader.readInt32()
var _3: [Api.MessageUserVote]?
if let _ = reader.readInt32() {
_3 = Api.parseVector(reader, elementSignature: 0, elementType: Api.MessageUserVote.self)
}
var _4: [Api.User]?
if let _ = reader.readInt32() {
_4 = Api.parseVector(reader, elementSignature: 0, elementType: Api.User.self)
}
var _5: String?
if Int(_1!) & Int(1 << 0) != 0 {_5 = parseString(reader) }
let _c1 = _1 != nil
let _c2 = _2 != nil
let _c3 = _3 != nil
let _c4 = _4 != nil
let _c5 = (Int(_1!) & Int(1 << 0) == 0) || _5 != nil
if _c1 && _c2 && _c3 && _c4 && _c5 {
return Api.messages.VotesList.votesList(flags: _1!, count: _2!, votes: _3!, users: _4!, nextOffset: _5)
}
else {
return nil
}
}
}
}
public extension Api.payments {
enum BankCardData: TypeConstructorDescription {
case bankCardData(title: String, openUrls: [Api.BankCardOpenUrl])

View File

@ -4564,6 +4564,21 @@ public extension Api.functions.messages {
})
}
}
public extension Api.functions.messages {
static func getEmojiGroups(hash: Int32) -> (FunctionDescription, Buffer, DeserializeFunctionResponse<Api.messages.EmojiGroups>) {
let buffer = Buffer()
buffer.appendInt32(1955122779)
serializeInt32(hash, buffer: buffer, boxed: false)
return (FunctionDescription(name: "messages.getEmojiGroups", parameters: [("hash", String(describing: hash))]), buffer, DeserializeFunctionResponse { (buffer: Buffer) -> Api.messages.EmojiGroups? in
let reader = BufferReader(buffer)
var result: Api.messages.EmojiGroups?
if let signature = reader.readInt32() {
result = Api.parse(reader, signature: signature) as? Api.messages.EmojiGroups
}
return result
})
}
}
public extension Api.functions.messages {
static func getEmojiKeywords(langCode: String) -> (FunctionDescription, Buffer, DeserializeFunctionResponse<Api.EmojiKeywordsDifference>) {
let buffer = Buffer()
@ -4614,6 +4629,21 @@ public extension Api.functions.messages {
})
}
}
public extension Api.functions.messages {
static func getEmojiStatusGroups(hash: Int32) -> (FunctionDescription, Buffer, DeserializeFunctionResponse<Api.messages.EmojiGroups>) {
let buffer = Buffer()
buffer.appendInt32(785209037)
serializeInt32(hash, buffer: buffer, boxed: false)
return (FunctionDescription(name: "messages.getEmojiStatusGroups", parameters: [("hash", String(describing: hash))]), buffer, DeserializeFunctionResponse { (buffer: Buffer) -> Api.messages.EmojiGroups? in
let reader = BufferReader(buffer)
var result: Api.messages.EmojiGroups?
if let signature = reader.readInt32() {
result = Api.parse(reader, signature: signature) as? Api.messages.EmojiGroups
}
return result
})
}
}
public extension Api.functions.messages {
static func getEmojiStickers(hash: Int64) -> (FunctionDescription, Buffer, DeserializeFunctionResponse<Api.messages.AllStickers>) {
let buffer = Buffer()
@ -6027,6 +6057,22 @@ public extension Api.functions.messages {
})
}
}
public extension Api.functions.messages {
static func searchCustomEmoji(emoticon: String, hash: Int64) -> (FunctionDescription, Buffer, DeserializeFunctionResponse<Api.EmojiList>) {
let buffer = Buffer()
buffer.appendInt32(739360983)
serializeString(emoticon, buffer: buffer, boxed: false)
serializeInt64(hash, buffer: buffer, boxed: false)
return (FunctionDescription(name: "messages.searchCustomEmoji", parameters: [("emoticon", String(describing: emoticon)), ("hash", String(describing: hash))]), buffer, DeserializeFunctionResponse { (buffer: Buffer) -> Api.EmojiList? in
let reader = BufferReader(buffer)
var result: Api.EmojiList?
if let signature = reader.readInt32() {
result = Api.parse(reader, signature: signature) as? Api.EmojiList
}
return result
})
}
}
public extension Api.functions.messages {
static func searchGlobal(flags: Int32, folderId: Int32?, q: String, filter: Api.MessagesFilter, minDate: Int32, maxDate: Int32, offsetRate: Int32, offsetPeer: Api.InputPeer, offsetId: Int32, limit: Int32) -> (FunctionDescription, Buffer, DeserializeFunctionResponse<Api.messages.Messages>) {
let buffer = Buffer()
@ -7676,12 +7722,12 @@ public extension Api.functions.photos {
public extension Api.functions.photos {
static func uploadProfilePhoto(flags: Int32, file: Api.InputFile?, video: Api.InputFile?, videoStartTs: Double?, videoEmojiMarkup: Api.VideoSize?) -> (FunctionDescription, Buffer, DeserializeFunctionResponse<Api.photos.Photo>) {
let buffer = Buffer()
buffer.appendInt32(-771759753)
buffer.appendInt32(154966609)
serializeInt32(flags, buffer: buffer, boxed: false)
if Int(flags) & Int(1 << 0) != 0 {file!.serialize(buffer, true)}
if Int(flags) & Int(1 << 1) != 0 {video!.serialize(buffer, true)}
if Int(flags) & Int(1 << 2) != 0 {serializeDouble(videoStartTs!, buffer: buffer, boxed: false)}
if Int(flags) & Int(1 << 3) != 0 {videoEmojiMarkup!.serialize(buffer, true)}
if Int(flags) & Int(1 << 4) != 0 {videoEmojiMarkup!.serialize(buffer, true)}
return (FunctionDescription(name: "photos.uploadProfilePhoto", parameters: [("flags", String(describing: flags)), ("file", String(describing: file)), ("video", String(describing: video)), ("videoStartTs", String(describing: videoStartTs)), ("videoEmojiMarkup", String(describing: videoEmojiMarkup))]), buffer, DeserializeFunctionResponse { (buffer: Buffer) -> Api.photos.Photo? in
let reader = BufferReader(buffer)
var result: Api.photos.Photo?

View File

@ -220,6 +220,56 @@ public extension Api {
}
}
public extension Api {
enum EmojiGroup: TypeConstructorDescription {
case emojiGroup(title: String, iconEmojiId: Int64, emoticons: [String])
public func serialize(_ buffer: Buffer, _ boxed: Swift.Bool) {
switch self {
case .emojiGroup(let title, let iconEmojiId, let emoticons):
if boxed {
buffer.appendInt32(2056961449)
}
serializeString(title, buffer: buffer, boxed: false)
serializeInt64(iconEmojiId, buffer: buffer, boxed: false)
buffer.appendInt32(481674261)
buffer.appendInt32(Int32(emoticons.count))
for item in emoticons {
serializeString(item, buffer: buffer, boxed: false)
}
break
}
}
public func descriptionFields() -> (String, [(String, Any)]) {
switch self {
case .emojiGroup(let title, let iconEmojiId, let emoticons):
return ("emojiGroup", [("title", title as Any), ("iconEmojiId", iconEmojiId as Any), ("emoticons", emoticons as Any)])
}
}
public static func parse_emojiGroup(_ reader: BufferReader) -> EmojiGroup? {
var _1: String?
_1 = parseString(reader)
var _2: Int64?
_2 = reader.readInt64()
var _3: [String]?
if let _ = reader.readInt32() {
_3 = Api.parseVector(reader, elementSignature: -1255641564, elementType: String.self)
}
let _c1 = _1 != nil
let _c2 = _2 != nil
let _c3 = _3 != nil
if _c1 && _c2 && _c3 {
return Api.EmojiGroup.emojiGroup(title: _1!, iconEmojiId: _2!, emoticons: _3!)
}
else {
return nil
}
}
}
}
public extension Api {
enum EmojiKeyword: TypeConstructorDescription {
case emojiKeyword(keyword: String, emoticons: [String])
@ -1054,47 +1104,3 @@ public extension Api {
}
}
public extension Api {
enum FileHash: TypeConstructorDescription {
case fileHash(offset: Int64, limit: Int32, hash: Buffer)
public func serialize(_ buffer: Buffer, _ boxed: Swift.Bool) {
switch self {
case .fileHash(let offset, let limit, let hash):
if boxed {
buffer.appendInt32(-207944868)
}
serializeInt64(offset, buffer: buffer, boxed: false)
serializeInt32(limit, buffer: buffer, boxed: false)
serializeBytes(hash, buffer: buffer, boxed: false)
break
}
}
public func descriptionFields() -> (String, [(String, Any)]) {
switch self {
case .fileHash(let offset, let limit, let hash):
return ("fileHash", [("offset", offset as Any), ("limit", limit as Any), ("hash", hash as Any)])
}
}
public static func parse_fileHash(_ reader: BufferReader) -> FileHash? {
var _1: Int64?
_1 = reader.readInt64()
var _2: Int32?
_2 = reader.readInt32()
var _3: Buffer?
_3 = parseBytes(reader)
let _c1 = _1 != nil
let _c2 = _2 != nil
let _c3 = _3 != nil
if _c1 && _c2 && _c3 {
return Api.FileHash.fileHash(offset: _1!, limit: _2!, hash: _3!)
}
else {
return nil
}
}
}
}

View File

@ -1,3 +1,47 @@
public extension Api {
enum FileHash: TypeConstructorDescription {
case fileHash(offset: Int64, limit: Int32, hash: Buffer)
public func serialize(_ buffer: Buffer, _ boxed: Swift.Bool) {
switch self {
case .fileHash(let offset, let limit, let hash):
if boxed {
buffer.appendInt32(-207944868)
}
serializeInt64(offset, buffer: buffer, boxed: false)
serializeInt32(limit, buffer: buffer, boxed: false)
serializeBytes(hash, buffer: buffer, boxed: false)
break
}
}
public func descriptionFields() -> (String, [(String, Any)]) {
switch self {
case .fileHash(let offset, let limit, let hash):
return ("fileHash", [("offset", offset as Any), ("limit", limit as Any), ("hash", hash as Any)])
}
}
public static func parse_fileHash(_ reader: BufferReader) -> FileHash? {
var _1: Int64?
_1 = reader.readInt64()
var _2: Int32?
_2 = reader.readInt32()
var _3: Buffer?
_3 = parseBytes(reader)
let _c1 = _1 != nil
let _c2 = _2 != nil
let _c3 = _3 != nil
if _c1 && _c2 && _c3 {
return Api.FileHash.fileHash(offset: _1!, limit: _2!, hash: _3!)
}
else {
return nil
}
}
}
}
public extension Api {
enum Folder: TypeConstructorDescription {
case folder(flags: Int32, id: Int32, title: String, photo: Api.ChatPhoto?)

View File

@ -15,7 +15,7 @@ public enum UploadPeerPhotoError {
}
func _internal_updateAccountPhoto(account: Account, resource: MediaResource?, videoResource: MediaResource?, videoStartTimestamp: Double?, fileId: Int64?, backgroundColors: [Int32]?, fallback: Bool, mapResourceToAvatarSizes: @escaping (MediaResource, [TelegramMediaImageRepresentation]) -> Signal<[Int: Data], NoError>) -> Signal<UpdatePeerPhotoStatus, UploadPeerPhotoError> {
return _internal_updatePeerPhoto(postbox: account.postbox, network: account.network, stateManager: account.stateManager, accountPeerId: account.peerId, peerId: account.peerId, photo: resource.flatMap({ _internal_uploadedPeerPhoto(postbox: account.postbox, network: account.network, resource: $0) }), video: videoResource.flatMap({ _internal_uploadedPeerVideo(postbox: account.postbox, network: account.network, messageMediaPreuploadManager: account.messageMediaPreuploadManager, resource: $0) |> map(Optional.init) }), videoStartTimestamp: videoStartTimestamp, fallback: fallback, mapResourceToAvatarSizes: mapResourceToAvatarSizes)
return _internal_updatePeerPhoto(postbox: account.postbox, network: account.network, stateManager: account.stateManager, accountPeerId: account.peerId, peerId: account.peerId, photo: resource.flatMap({ _internal_uploadedPeerPhoto(postbox: account.postbox, network: account.network, resource: $0) }), video: videoResource.flatMap({ _internal_uploadedPeerVideo(postbox: account.postbox, network: account.network, messageMediaPreuploadManager: account.messageMediaPreuploadManager, resource: $0) |> map(Optional.init) }), videoStartTimestamp: videoStartTimestamp, fileId: fileId, backgroundColors: backgroundColors, fallback: fallback, mapResourceToAvatarSizes: mapResourceToAvatarSizes)
}
public enum SetCustomPeerPhotoMode {
@ -77,7 +77,7 @@ func _internal_uploadedPeerVideo(postbox: Postbox, network: Network, messageMedi
}
func _internal_updatePeerPhoto(postbox: Postbox, network: Network, stateManager: AccountStateManager?, accountPeerId: PeerId, peerId: PeerId, photo: Signal<UploadedPeerPhotoData, NoError>?, video: Signal<UploadedPeerPhotoData?, NoError>? = nil, videoStartTimestamp: Double? = nil, fileId: Int64? = nil, backgroundColors: [Int32]? = nil, fallback: Bool = false, customPeerPhotoMode: SetCustomPeerPhotoMode? = nil, mapResourceToAvatarSizes: @escaping (MediaResource, [TelegramMediaImageRepresentation]) -> Signal<[Int: Data], NoError>) -> Signal<UpdatePeerPhotoStatus, UploadPeerPhotoError> {
return _internal_updatePeerPhotoInternal(postbox: postbox, network: network, stateManager: stateManager, accountPeerId: accountPeerId, peer: postbox.loadedPeerWithId(peerId), photo: photo, video: video, videoStartTimestamp: videoStartTimestamp, fallback: fallback, customPeerPhotoMode: customPeerPhotoMode, mapResourceToAvatarSizes: mapResourceToAvatarSizes)
return _internal_updatePeerPhotoInternal(postbox: postbox, network: network, stateManager: stateManager, accountPeerId: accountPeerId, peer: postbox.loadedPeerWithId(peerId), photo: photo, video: video, videoStartTimestamp: videoStartTimestamp, fileId: fileId, backgroundColors: backgroundColors, fallback: fallback, customPeerPhotoMode: customPeerPhotoMode, mapResourceToAvatarSizes: mapResourceToAvatarSizes)
}
func _internal_updatePeerPhotoInternal(postbox: Postbox, network: Network, stateManager: AccountStateManager?, accountPeerId: PeerId, peer: Signal<Peer, NoError>, photo: Signal<UploadedPeerPhotoData, NoError>?, video: Signal<UploadedPeerPhotoData?, NoError>?, videoStartTimestamp: Double?, fileId: Int64? = nil, backgroundColors: [Int32]? = nil, fallback: Bool = false, customPeerPhotoMode: SetCustomPeerPhotoMode? = nil, mapResourceToAvatarSizes: @escaping (MediaResource, [TelegramMediaImageRepresentation]) -> Signal<[Int: Data], NoError>) -> Signal<UpdatePeerPhotoStatus, UploadPeerPhotoError> {

View File

@ -451,11 +451,24 @@ final class AvatarEditorScreenComponent: Component {
guard let strongSelf = self, let controller = strongSelf.controller?() else {
return
}
if groupId == AnyHashable("popular") {
let presentationData = controller.context.sharedContext.currentPresentationData.with { $0 }.withUpdated(theme: defaultDarkColorPresentationTheme)
let context = controller.context
let presentationData = controller.context.sharedContext.currentPresentationData.with { $0 }
if groupId == AnyHashable("recent") {
let actionSheet = ActionSheetController(theme: ActionSheetControllerTheme(presentationTheme: presentationData.theme, fontSize: presentationData.listsFontSize))
var items: [ActionSheetItem] = []
items.append(ActionSheetButtonItem(title: presentationData.strings.Emoji_ClearRecent, color: .destructive, action: { [weak actionSheet] in
actionSheet?.dismissAnimated()
let _ = context.engine.stickers.clearRecentlyUsedEmoji().start()
}))
actionSheet.setItemGroups([ActionSheetItemGroup(items: items), ActionSheetItemGroup(items: [
ActionSheetButtonItem(title: presentationData.strings.Common_Cancel, color: .accent, font: .bold, action: { [weak actionSheet] in
actionSheet?.dismissAnimated()
})
])])
context.sharedContext.mainWindow?.presentInGlobalOverlay(actionSheet)
} else if groupId == AnyHashable("popular") {
let actionSheet = ActionSheetController(theme: ActionSheetControllerTheme(presentationTheme: presentationData.theme, fontSize: presentationData.listsFontSize))
var items: [ActionSheetItem] = []
let context = controller.context
items.append(ActionSheetTextItem(title: presentationData.strings.Chat_ClearReactionsAlertText, parseMarkdown: true))
items.append(ActionSheetButtonItem(title: presentationData.strings.Chat_ClearReactionsAlertAction, color: .destructive, action: { [weak actionSheet] in
actionSheet?.dismissAnimated()
@ -574,7 +587,7 @@ final class AvatarEditorScreenComponent: Component {
}
let context = controller.context
if groupId == AnyHashable("recent") {
let presentationData = context.sharedContext.currentPresentationData.with { $0 }.withUpdated(theme: defaultDarkColorPresentationTheme)
let presentationData = context.sharedContext.currentPresentationData.with { $0 }
let actionSheet = ActionSheetController(theme: ActionSheetControllerTheme(presentationTheme: presentationData.theme, fontSize: presentationData.listsFontSize))
var items: [ActionSheetItem] = []
items.append(ActionSheetButtonItem(title: presentationData.strings.Stickers_ClearRecent, color: .destructive, action: { [weak actionSheet] in

View File

@ -59,6 +59,7 @@ final class AvatarPreviewComponent: Component {
private weak var state: EmptyComponentState?
private let stickerFetchedDisposable = MetaDisposable()
private let cachedDisposable = MetaDisposable()
override init(frame: CGRect) {
self.imageView = UIImageView()
@ -84,6 +85,7 @@ final class AvatarPreviewComponent: Component {
deinit {
self.stickerFetchedDisposable.dispose()
self.cachedDisposable.dispose()
}
@objc func tapped() {
@ -202,6 +204,9 @@ final class AvatarPreviewComponent: Component {
let source = AnimatedStickerResourceSource(account: component.context.account, resource: file.resource, isVideo: file.isVideoSticker || file.mimeType == "video/webm")
self.animationNode?.setup(source: source, width: Int(fittedDimensions.width), height: Int(fittedDimensions.height), playbackMode: .count(2), mode: .direct(cachePathPrefix: nil))
self.animationNode?.visibility = true
self.cachedDisposable.set((source.cachedDataPath(width: 384, height: 384)
|> deliverOn(Queue.concurrentDefaultQueue())).start())
}
}

View File

@ -0,0 +1,22 @@
{
"images" : [
{
"idiom" : "universal",
"scale" : "1x"
},
{
"filename" : "LaunchLogo@2x.png",
"idiom" : "universal",
"scale" : "2x"
},
{
"filename" : "LaunchLogo@3x.png",
"idiom" : "universal",
"scale" : "3x"
}
],
"info" : {
"author" : "xcode",
"version" : 1
}
}

Binary file not shown.

After

Width:  |  Height:  |  Size: 7.7 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 12 KiB

View File

@ -316,8 +316,8 @@ private func extractAccountManagerState(records: AccountRecordsView<TelegramAcco
self.window = window
self.nativeWindow = window
let launchIconSize = CGSize(width: 120.0, height: 120.0)
let launchIconView = UIImageView(image: UIImage(bundleImageName: "Chat/Links/QrLogo"))
let launchIconSize = CGSize(width: 99.0, height: 99.0)
let launchIconView = UIImageView(image: UIImage(bundleImageName: "Components/LaunchLogo"))
launchIconView.frame = CGRect(origin: CGPoint(x: floorToScreenPixels((hostView.containerView.frame.width - launchIconSize.width) / 2.0), y: floorToScreenPixels((hostView.containerView.frame.height - launchIconSize.height) / 2.0)), size: launchIconSize)
hostView.containerView.addSubview(launchIconView)

View File

@ -7094,7 +7094,7 @@ final class PeerInfoScreenNode: ViewControllerTracingNode, UIScrollViewDelegate
return mapResourceToAvatarSizes(postbox: account.postbox, resource: resource, representations: representations)
})
} else {
return context.engine.accountData.updateAccountPhoto(resource: photoResource, videoResource: videoResource, videoStartTimestamp: videoStartTimestamp, fileId: nil, backgroundColors: nil, mapResourceToAvatarSizes: { resource, representations in
return context.engine.accountData.updateAccountPhoto(resource: photoResource, videoResource: videoResource, videoStartTimestamp: videoStartTimestamp, fileId: fileId, backgroundColors: backgroundColors, mapResourceToAvatarSizes: { resource, representations in
return mapResourceToAvatarSizes(postbox: account.postbox, resource: resource, representations: representations)
})
}