Skip to content

Commit e2b49cc

Browse files
committed
Merge branch 'master' of gitlab.com:peter-iakovlev/telegram-ios
2 parents 52adb30 + 0ac2602 commit e2b49cc

File tree

18 files changed

+402
-285
lines changed

18 files changed

+402
-285
lines changed

Telegram/Telegram-iOS/en.lproj/Localizable.strings

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15489,6 +15489,9 @@ Error: %8$@";
1548915489
"Gift.Auction.StartsInHours" = "auction starts in {h}:{m}:{s}";
1549015490
"Gift.Auction.StartsInMinutes" = "auction starts in {m}:{s}";
1549115491
"Gift.Auction.EarlyBid" = "Place an Early Bid";
15492+
"Gift.Auction.ViewVariants" = "View";
15493+
"Gift.Auction.Variants_1" = "%@ Variant";
15494+
"Gift.Auction.Variants_any" = "%@ Variants";
1549215495

1549315496
"Gift.Auction.Hours_1" = "%@ hour";
1549415497
"Gift.Auction.Hours_any" = "%@ hours";

submodules/AccountContext/Sources/AccountContext.swift

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1429,6 +1429,7 @@ public protocol SharedAccountContext: AnyObject {
14291429
func makeGiftAuctionViewScreen(context: AccountContext, auctionContext: GiftAuctionContext, completion: @escaping (Signal<[GiftAuctionAcquiredGift], NoError>) -> Void) -> ViewController
14301430
func makeGiftAuctionActiveBidsScreen(context: AccountContext) -> ViewController
14311431
func makeGiftOfferScreen(context: AccountContext, gift: StarGift.UniqueGift, peer: EnginePeer, amount: CurrencyAmount, commit: @escaping () -> Void) -> ViewController
1432+
func makeGiftUpgradeVariantsPreviewScreen(context: AccountContext, gift: StarGift, attributes: [StarGift.UniqueGift.Attribute]) -> ViewController
14321433

14331434
func makeStorySharingScreen(context: AccountContext, subject: StorySharingSubject, parentController: ViewController) -> ViewController
14341435

submodules/TelegramApi/Sources/Api0.swift

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -980,7 +980,7 @@ fileprivate let parsers: [Int32 : (BufferReader) -> Any?] = {
980980
dict[2109703795] = { return Api.SponsoredMessage.parse_sponsoredMessage($0) }
981981
dict[1124938064] = { return Api.SponsoredMessageReportOption.parse_sponsoredMessageReportOption($0) }
982982
dict[-963180333] = { return Api.SponsoredPeer.parse_sponsoredPeer($0) }
983-
dict[1453798502] = { return Api.StarGift.parse_starGift($0) }
983+
dict[825922887] = { return Api.StarGift.parse_starGift($0) }
984984
dict[1453155529] = { return Api.StarGift.parse_starGiftUnique($0) }
985985
dict[-753154979] = { return Api.StarGiftActiveAuctionState.parse_starGiftActiveAuctionState($0) }
986986
dict[-650279524] = { return Api.StarGiftAttribute.parse_starGiftAttributeBackdrop($0) }
@@ -995,9 +995,10 @@ fileprivate let parsers: [Int32 : (BufferReader) -> Any?] = {
995995
dict[984483112] = { return Api.StarGiftAuctionRound.parse_starGiftAuctionRound($0) }
996996
dict[178266597] = { return Api.StarGiftAuctionRound.parse_starGiftAuctionRoundExtendable($0) }
997997
dict[1998212710] = { return Api.StarGiftAuctionState.parse_starGiftAuctionState($0) }
998-
dict[2107014202] = { return Api.StarGiftAuctionState.parse_starGiftAuctionStateFinished($0) }
998+
dict[-1758614593] = { return Api.StarGiftAuctionState.parse_starGiftAuctionStateFinished($0) }
999999
dict[-30197422] = { return Api.StarGiftAuctionState.parse_starGiftAuctionStateNotModified($0) }
10001000
dict[787403204] = { return Api.StarGiftAuctionUserState.parse_starGiftAuctionUserState($0) }
1001+
dict[-1342872680] = { return Api.StarGiftBackground.parse_starGiftBackground($0) }
10011002
dict[-1653926992] = { return Api.StarGiftCollection.parse_starGiftCollection($0) }
10021003
dict[-1712704739] = { return Api.StarGiftUpgradePrice.parse_starGiftUpgradePrice($0) }
10031004
dict[-586389774] = { return Api.StarRefProgram.parse_starRefProgram($0) }
@@ -1254,7 +1255,7 @@ fileprivate let parsers: [Int32 : (BufferReader) -> Any?] = {
12541255
dict[555358088] = { return Api.WebPage.parse_webPageEmpty($0) }
12551256
dict[1930545681] = { return Api.WebPage.parse_webPageNotModified($0) }
12561257
dict[-1328464313] = { return Api.WebPage.parse_webPagePending($0) }
1257-
dict[55150251] = { return Api.WebPageAttribute.parse_webPageAttributeStarGiftAuction($0) }
1258+
dict[29770178] = { return Api.WebPageAttribute.parse_webPageAttributeStarGiftAuction($0) }
12581259
dict[835375875] = { return Api.WebPageAttribute.parse_webPageAttributeStarGiftCollection($0) }
12591260
dict[1355547603] = { return Api.WebPageAttribute.parse_webPageAttributeStickerSet($0) }
12601261
dict[781501415] = { return Api.WebPageAttribute.parse_webPageAttributeStory($0) }
@@ -2252,6 +2253,8 @@ public extension Api {
22522253
_1.serialize(buffer, boxed)
22532254
case let _1 as Api.StarGiftAuctionUserState:
22542255
_1.serialize(buffer, boxed)
2256+
case let _1 as Api.StarGiftBackground:
2257+
_1.serialize(buffer, boxed)
22552258
case let _1 as Api.StarGiftCollection:
22562259
_1.serialize(buffer, boxed)
22572260
case let _1 as Api.StarGiftUpgradePrice:

submodules/TelegramApi/Sources/Api25.swift

Lines changed: 82 additions & 68 deletions
Large diffs are not rendered by default.

submodules/TelegramApi/Sources/Api26.swift

Lines changed: 52 additions & 56 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,55 @@
1+
public extension Api {
2+
enum StarsRating: TypeConstructorDescription {
3+
case starsRating(flags: Int32, level: Int32, currentLevelStars: Int64, stars: Int64, nextLevelStars: Int64?)
4+
5+
public func serialize(_ buffer: Buffer, _ boxed: Swift.Bool) {
6+
switch self {
7+
case .starsRating(let flags, let level, let currentLevelStars, let stars, let nextLevelStars):
8+
if boxed {
9+
buffer.appendInt32(453922567)
10+
}
11+
serializeInt32(flags, buffer: buffer, boxed: false)
12+
serializeInt32(level, buffer: buffer, boxed: false)
13+
serializeInt64(currentLevelStars, buffer: buffer, boxed: false)
14+
serializeInt64(stars, buffer: buffer, boxed: false)
15+
if Int(flags) & Int(1 << 0) != 0 {serializeInt64(nextLevelStars!, buffer: buffer, boxed: false)}
16+
break
17+
}
18+
}
19+
20+
public func descriptionFields() -> (String, [(String, Any)]) {
21+
switch self {
22+
case .starsRating(let flags, let level, let currentLevelStars, let stars, let nextLevelStars):
23+
return ("starsRating", [("flags", flags as Any), ("level", level as Any), ("currentLevelStars", currentLevelStars as Any), ("stars", stars as Any), ("nextLevelStars", nextLevelStars as Any)])
24+
}
25+
}
26+
27+
public static func parse_starsRating(_ reader: BufferReader) -> StarsRating? {
28+
var _1: Int32?
29+
_1 = reader.readInt32()
30+
var _2: Int32?
31+
_2 = reader.readInt32()
32+
var _3: Int64?
33+
_3 = reader.readInt64()
34+
var _4: Int64?
35+
_4 = reader.readInt64()
36+
var _5: Int64?
37+
if Int(_1!) & Int(1 << 0) != 0 {_5 = reader.readInt64() }
38+
let _c1 = _1 != nil
39+
let _c2 = _2 != nil
40+
let _c3 = _3 != nil
41+
let _c4 = _4 != nil
42+
let _c5 = (Int(_1!) & Int(1 << 0) == 0) || _5 != nil
43+
if _c1 && _c2 && _c3 && _c4 && _c5 {
44+
return Api.StarsRating.starsRating(flags: _1!, level: _2!, currentLevelStars: _3!, stars: _4!, nextLevelStars: _5)
45+
}
46+
else {
47+
return nil
48+
}
49+
}
50+
51+
}
52+
}
153
public extension Api {
254
enum StarsRevenueStatus: TypeConstructorDescription {
355
case starsRevenueStatus(flags: Int32, currentBalance: Api.StarsAmount, availableBalance: Api.StarsAmount, overallRevenue: Api.StarsAmount, nextWithdrawalAt: Int32?)
@@ -1236,59 +1288,3 @@ public extension Api {
12361288

12371289
}
12381290
}
1239-
public extension Api {
1240-
enum StoryAlbum: TypeConstructorDescription {
1241-
case storyAlbum(flags: Int32, albumId: Int32, title: String, iconPhoto: Api.Photo?, iconVideo: Api.Document?)
1242-
1243-
public func serialize(_ buffer: Buffer, _ boxed: Swift.Bool) {
1244-
switch self {
1245-
case .storyAlbum(let flags, let albumId, let title, let iconPhoto, let iconVideo):
1246-
if boxed {
1247-
buffer.appendInt32(-1826262950)
1248-
}
1249-
serializeInt32(flags, buffer: buffer, boxed: false)
1250-
serializeInt32(albumId, buffer: buffer, boxed: false)
1251-
serializeString(title, buffer: buffer, boxed: false)
1252-
if Int(flags) & Int(1 << 0) != 0 {iconPhoto!.serialize(buffer, true)}
1253-
if Int(flags) & Int(1 << 1) != 0 {iconVideo!.serialize(buffer, true)}
1254-
break
1255-
}
1256-
}
1257-
1258-
public func descriptionFields() -> (String, [(String, Any)]) {
1259-
switch self {
1260-
case .storyAlbum(let flags, let albumId, let title, let iconPhoto, let iconVideo):
1261-
return ("storyAlbum", [("flags", flags as Any), ("albumId", albumId as Any), ("title", title as Any), ("iconPhoto", iconPhoto as Any), ("iconVideo", iconVideo as Any)])
1262-
}
1263-
}
1264-
1265-
public static func parse_storyAlbum(_ reader: BufferReader) -> StoryAlbum? {
1266-
var _1: Int32?
1267-
_1 = reader.readInt32()
1268-
var _2: Int32?
1269-
_2 = reader.readInt32()
1270-
var _3: String?
1271-
_3 = parseString(reader)
1272-
var _4: Api.Photo?
1273-
if Int(_1!) & Int(1 << 0) != 0 {if let signature = reader.readInt32() {
1274-
_4 = Api.parse(reader, signature: signature) as? Api.Photo
1275-
} }
1276-
var _5: Api.Document?
1277-
if Int(_1!) & Int(1 << 1) != 0 {if let signature = reader.readInt32() {
1278-
_5 = Api.parse(reader, signature: signature) as? Api.Document
1279-
} }
1280-
let _c1 = _1 != nil
1281-
let _c2 = _2 != nil
1282-
let _c3 = _3 != nil
1283-
let _c4 = (Int(_1!) & Int(1 << 0) == 0) || _4 != nil
1284-
let _c5 = (Int(_1!) & Int(1 << 1) == 0) || _5 != nil
1285-
if _c1 && _c2 && _c3 && _c4 && _c5 {
1286-
return Api.StoryAlbum.storyAlbum(flags: _1!, albumId: _2!, title: _3!, iconPhoto: _4, iconVideo: _5)
1287-
}
1288-
else {
1289-
return nil
1290-
}
1291-
}
1292-
1293-
}
1294-
}

submodules/TelegramApi/Sources/Api27.swift

Lines changed: 56 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,59 @@
1+
public extension Api {
2+
enum StoryAlbum: TypeConstructorDescription {
3+
case storyAlbum(flags: Int32, albumId: Int32, title: String, iconPhoto: Api.Photo?, iconVideo: Api.Document?)
4+
5+
public func serialize(_ buffer: Buffer, _ boxed: Swift.Bool) {
6+
switch self {
7+
case .storyAlbum(let flags, let albumId, let title, let iconPhoto, let iconVideo):
8+
if boxed {
9+
buffer.appendInt32(-1826262950)
10+
}
11+
serializeInt32(flags, buffer: buffer, boxed: false)
12+
serializeInt32(albumId, buffer: buffer, boxed: false)
13+
serializeString(title, buffer: buffer, boxed: false)
14+
if Int(flags) & Int(1 << 0) != 0 {iconPhoto!.serialize(buffer, true)}
15+
if Int(flags) & Int(1 << 1) != 0 {iconVideo!.serialize(buffer, true)}
16+
break
17+
}
18+
}
19+
20+
public func descriptionFields() -> (String, [(String, Any)]) {
21+
switch self {
22+
case .storyAlbum(let flags, let albumId, let title, let iconPhoto, let iconVideo):
23+
return ("storyAlbum", [("flags", flags as Any), ("albumId", albumId as Any), ("title", title as Any), ("iconPhoto", iconPhoto as Any), ("iconVideo", iconVideo as Any)])
24+
}
25+
}
26+
27+
public static func parse_storyAlbum(_ reader: BufferReader) -> StoryAlbum? {
28+
var _1: Int32?
29+
_1 = reader.readInt32()
30+
var _2: Int32?
31+
_2 = reader.readInt32()
32+
var _3: String?
33+
_3 = parseString(reader)
34+
var _4: Api.Photo?
35+
if Int(_1!) & Int(1 << 0) != 0 {if let signature = reader.readInt32() {
36+
_4 = Api.parse(reader, signature: signature) as? Api.Photo
37+
} }
38+
var _5: Api.Document?
39+
if Int(_1!) & Int(1 << 1) != 0 {if let signature = reader.readInt32() {
40+
_5 = Api.parse(reader, signature: signature) as? Api.Document
41+
} }
42+
let _c1 = _1 != nil
43+
let _c2 = _2 != nil
44+
let _c3 = _3 != nil
45+
let _c4 = (Int(_1!) & Int(1 << 0) == 0) || _4 != nil
46+
let _c5 = (Int(_1!) & Int(1 << 1) == 0) || _5 != nil
47+
if _c1 && _c2 && _c3 && _c4 && _c5 {
48+
return Api.StoryAlbum.storyAlbum(flags: _1!, albumId: _2!, title: _3!, iconPhoto: _4, iconVideo: _5)
49+
}
50+
else {
51+
return nil
52+
}
53+
}
54+
55+
}
56+
}
157
public extension Api {
258
enum StoryFwdHeader: TypeConstructorDescription {
359
case storyFwdHeader(flags: Int32, from: Api.Peer?, fromName: String?, storyId: Int32?)

submodules/TelegramApi/Sources/Api29.swift

Lines changed: 7 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
public extension Api {
22
indirect enum WebPageAttribute: TypeConstructorDescription {
3-
case webPageAttributeStarGiftAuction(gift: Api.StarGift, endDate: Int32, centerColor: Int32, edgeColor: Int32, textColor: Int32)
3+
case webPageAttributeStarGiftAuction(gift: Api.StarGift, endDate: Int32)
44
case webPageAttributeStarGiftCollection(icons: [Api.Document])
55
case webPageAttributeStickerSet(flags: Int32, stickers: [Api.Document])
66
case webPageAttributeStory(flags: Int32, peer: Api.Peer, id: Int32, story: Api.StoryItem?)
@@ -9,15 +9,12 @@ public extension Api {
99

1010
public func serialize(_ buffer: Buffer, _ boxed: Swift.Bool) {
1111
switch self {
12-
case .webPageAttributeStarGiftAuction(let gift, let endDate, let centerColor, let edgeColor, let textColor):
12+
case .webPageAttributeStarGiftAuction(let gift, let endDate):
1313
if boxed {
14-
buffer.appendInt32(55150251)
14+
buffer.appendInt32(29770178)
1515
}
1616
gift.serialize(buffer, true)
1717
serializeInt32(endDate, buffer: buffer, boxed: false)
18-
serializeInt32(centerColor, buffer: buffer, boxed: false)
19-
serializeInt32(edgeColor, buffer: buffer, boxed: false)
20-
serializeInt32(textColor, buffer: buffer, boxed: false)
2118
break
2219
case .webPageAttributeStarGiftCollection(let icons):
2320
if boxed {
@@ -72,8 +69,8 @@ public extension Api {
7269

7370
public func descriptionFields() -> (String, [(String, Any)]) {
7471
switch self {
75-
case .webPageAttributeStarGiftAuction(let gift, let endDate, let centerColor, let edgeColor, let textColor):
76-
return ("webPageAttributeStarGiftAuction", [("gift", gift as Any), ("endDate", endDate as Any), ("centerColor", centerColor as Any), ("edgeColor", edgeColor as Any), ("textColor", textColor as Any)])
72+
case .webPageAttributeStarGiftAuction(let gift, let endDate):
73+
return ("webPageAttributeStarGiftAuction", [("gift", gift as Any), ("endDate", endDate as Any)])
7774
case .webPageAttributeStarGiftCollection(let icons):
7875
return ("webPageAttributeStarGiftCollection", [("icons", icons as Any)])
7976
case .webPageAttributeStickerSet(let flags, let stickers):
@@ -94,19 +91,10 @@ public extension Api {
9491
}
9592
var _2: Int32?
9693
_2 = reader.readInt32()
97-
var _3: Int32?
98-
_3 = reader.readInt32()
99-
var _4: Int32?
100-
_4 = reader.readInt32()
101-
var _5: Int32?
102-
_5 = reader.readInt32()
10394
let _c1 = _1 != nil
10495
let _c2 = _2 != nil
105-
let _c3 = _3 != nil
106-
let _c4 = _4 != nil
107-
let _c5 = _5 != nil
108-
if _c1 && _c2 && _c3 && _c4 && _c5 {
109-
return Api.WebPageAttribute.webPageAttributeStarGiftAuction(gift: _1!, endDate: _2!, centerColor: _3!, edgeColor: _4!, textColor: _5!)
96+
if _c1 && _c2 {
97+
return Api.WebPageAttribute.webPageAttributeStarGiftAuction(gift: _1!, endDate: _2!)
11098
}
11199
else {
112100
return nil

submodules/TelegramCore/Sources/ApiUtils/TelegramMediaWebpage.swift

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -32,11 +32,11 @@ func telegramMediaWebpageAttributeFromApiWebpageAttribute(_ attribute: Api.WebPa
3232
var files: [TelegramMediaFile] = []
3333
files = icons.compactMap { telegramMediaFileFromApiDocument($0, altDocuments: []) }
3434
return .giftCollection(TelegramMediaWebpageGiftCollectionAttribute(files: files))
35-
case let .webPageAttributeStarGiftAuction(apiGift, endDate, centerColor, edgeColor, textColor):
35+
case let .webPageAttributeStarGiftAuction(apiGift, endDate):
3636
guard let gift = StarGift(apiStarGift: apiGift) else {
3737
return nil
3838
}
39-
return .giftAuction(TelegramMediaWebpageGiftAuctionAttribute(gift: gift, endDate: endDate, centerColor: centerColor, edgeColor: edgeColor, textColor: textColor))
39+
return .giftAuction(TelegramMediaWebpageGiftAuctionAttribute(gift: gift, endDate: endDate))
4040
case .webPageAttributeStory:
4141
return nil
4242
}

submodules/TelegramCore/Sources/SyncCore/SyncCore_TelegramMediaWebpage.swift

Lines changed: 2 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -210,52 +210,28 @@ public final class TelegramMediaWebpageGiftAuctionAttribute: PostboxCoding, Equa
210210
if lhs.endDate != rhs.endDate {
211211
return false
212212
}
213-
if lhs.centerColor != rhs.centerColor {
214-
return false
215-
}
216-
if lhs.edgeColor != rhs.edgeColor {
217-
return false
218-
}
219-
if lhs.textColor != rhs.textColor {
220-
return false
221-
}
222213
return true
223214
}
224215

225216
public let gift: StarGift
226217
public let endDate: Int32
227-
public let centerColor: Int32
228-
public let edgeColor: Int32
229-
public let textColor: Int32
230-
218+
231219
public init(
232220
gift: StarGift,
233-
endDate: Int32,
234-
centerColor: Int32,
235-
edgeColor: Int32,
236-
textColor: Int32
221+
endDate: Int32
237222
) {
238223
self.gift = gift
239224
self.endDate = endDate
240-
self.centerColor = centerColor
241-
self.edgeColor = edgeColor
242-
self.textColor = textColor
243225
}
244226

245227
public init(decoder: PostboxDecoder) {
246228
self.gift = decoder.decodeObjectForKey("gift", decoder: { StarGift(decoder: $0) }) as! StarGift
247229
self.endDate = decoder.decodeInt32ForKey("endDate", orElse: 0)
248-
self.centerColor = decoder.decodeInt32ForKey("centerColor", orElse: 0)
249-
self.edgeColor = decoder.decodeInt32ForKey("edgeColor", orElse: 0)
250-
self.textColor = decoder.decodeInt32ForKey("textColor", orElse: 0)
251230
}
252231

253232
public func encode(_ encoder: PostboxEncoder) {
254233
encoder.encodeObject(self.gift, forKey: "gift")
255234
encoder.encodeInt32(self.endDate, forKey: "endDate")
256-
encoder.encodeInt32(self.centerColor, forKey: "centerColor")
257-
encoder.encodeInt32(self.edgeColor, forKey: "edgeColor")
258-
encoder.encodeInt32(self.textColor, forKey: "textColor")
259235
}
260236
}
261237

0 commit comments

Comments
 (0)