Skip to content

Commit 5046aab

Browse files
committed
Update API
1 parent 95526c1 commit 5046aab

File tree

40 files changed

+1884
-812
lines changed

40 files changed

+1884
-812
lines changed

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

Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15466,3 +15466,37 @@ Error: %8$@";
1546615466
"CreateExternalStream.RevokeStreamKey" = "Revoke Stream Key";
1546715467
"CreateExternalStream.Revoke.Text" = "Do you want to revoke the stream key?";
1546815468
"CreateExternalStream.Revoke.Revoke" = "Revoke";
15469+
15470+
"Gift.AuctionBid.UntilEnd" = "until the end";
15471+
"Gift.AuctionBid.BeforeStart" = "before start";
15472+
"Gift.AuctionBid.RoundSubtitle" = "Round %@ of %@";
15473+
"Gift.AuctionBid.TopWinnersTotal" = "Top 3 of %@ Winners";
15474+
15475+
"Gift.Acquired.GiftRound" = "%1$@ in round %2$@";
15476+
15477+
"Gift.Options.Gift.Soon" = "soon";
15478+
15479+
"Chat.Auction.StartsIn" = "starts in ";
15480+
"Chat.Auction.View" = "VIEW";
15481+
"Chat.Auction.Upcoming" = "Upcoming Auction";
15482+
15483+
"Gift.Auction.Start" = "Start";
15484+
"Gift.Auction.End" = "End";
15485+
"Gift.Auction.Quantity" = "Quantity";
15486+
"Gift.Auction.TotalRounds" = "Rounds";
15487+
"Gift.Auction.TimeRound" = "Round %@";
15488+
"Gift.Auction.TimeRounds" = "Rounds %@";
15489+
"Gift.Auction.StartsInHours" = "auction starts in {h}:{m}:{s}";
15490+
"Gift.Auction.StartsInMinutes" = "auction starts in {m}:{s}";
15491+
"Gift.Auction.EarlyBid" = "Place an Early Bid";
15492+
15493+
"Gift.Auction.Hours_1" = "%@ hour";
15494+
"Gift.Auction.Hours_any" = "%@ hours";
15495+
"Gift.Auction.Minutes_1" = "%@ minute";
15496+
"Gift.Auction.Minutes_any" = "%@ minutes";
15497+
"Gift.Auction.HoursEach_1" = "%@ hour each";
15498+
"Gift.Auction.HoursEach_any" = "%@ hours each";
15499+
"Gift.Auction.MinutesEach_1" = "%@ minute each";
15500+
"Gift.Auction.MinutesEach_any" = "%@ minutes each";
15501+
15502+
"ChatList.Auctions.UpcomingAuction" = "Upcoming Auction";

submodules/AccountContext/Sources/AccountContext.swift

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1422,7 +1422,8 @@ public protocol SharedAccountContext: AnyObject {
14221422
func makeStarsIntroScreen(context: AccountContext) -> ViewController
14231423
func makeGiftViewScreen(context: AccountContext, message: EngineMessage, shareStory: ((StarGift.UniqueGift) -> Void)?) -> ViewController
14241424
func makeGiftViewScreen(context: AccountContext, gift: StarGift.UniqueGift, shareStory: ((StarGift.UniqueGift) -> Void)?, openChatTheme: (() -> Void)?, dismissed: (() -> Void)?) -> ViewController
1425-
func makeGiftWearPreviewScreen(context: AccountContext, gift: StarGift.UniqueGift) -> ViewController
1425+
func makeGiftWearPreviewScreen(context: AccountContext, gift: StarGift, attributes: [StarGift.UniqueGift.Attribute]?) -> ViewController
1426+
func makeGiftUpgradePreviewScreen(context: AccountContext, attributes: [StarGift.UniqueGift.Attribute], peerName: String) -> ViewController
14261427
func makeGiftAuctionInfoScreen(context: AccountContext, auctionContext: GiftAuctionContext, completion: (() -> Void)?) -> ViewController
14271428
func makeGiftAuctionBidScreen(context: AccountContext, toPeerId: EnginePeer.Id, text: String?, entities: [MessageTextEntity]?, hideName: Bool, auctionContext: GiftAuctionContext, acquiredGifts: Signal<[GiftAuctionAcquiredGift], NoError>?) -> ViewController
14281429
func makeGiftAuctionViewScreen(context: AccountContext, auctionContext: GiftAuctionContext, completion: @escaping (Signal<[GiftAuctionAcquiredGift], NoError>) -> Void) -> ViewController

submodules/PeerInfoUI/Sources/ChannelAdminController.swift

Lines changed: 1 addition & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -548,34 +548,6 @@ private func stringForRight(strings: PresentationStrings, right: TelegramChatAdm
548548
}
549549
}
550550

551-
private func rightDependencies(_ right: TelegramChatAdminRightsFlags) -> [TelegramChatAdminRightsFlags] {
552-
if right.contains(.canChangeInfo) {
553-
return []
554-
} else if right.contains(.canPostMessages) {
555-
return []
556-
} else if right.contains(.canEditMessages) {
557-
return []
558-
} else if right.contains(.canDeleteMessages) {
559-
return []
560-
} else if right.contains(.canBanUsers) {
561-
return []
562-
} else if right.contains(.canInviteUsers) {
563-
return []
564-
} else if right.contains(.canPinMessages) {
565-
return []
566-
} else if right.contains(.canAddAdmins) {
567-
return []
568-
} else if right.contains(.canManageDirect) {
569-
return []
570-
} else if right.contains(.canManageCalls) {
571-
return []
572-
} else if right.contains(.canBeAnonymous) {
573-
return []
574-
} else {
575-
return []
576-
}
577-
}
578-
579551
private func canEditAdminRights(accountPeerId: EnginePeer.Id, channelPeer: EnginePeer, initialParticipant: ChannelParticipant?) -> Bool {
580552
if case let .channel(channel) = channelPeer {
581553
if channel.flags.contains(.isCreator) {
@@ -658,6 +630,7 @@ private func channelAdminControllerEntries(presentationData: PresentationData, s
658630
.direct(.canChangeInfo),
659631
.sub(.messages, messageRelatedFlags),
660632
.sub(.stories, storiesRelatedFlags),
633+
.direct(.canBanUsers),
661634
.direct(.canInviteUsers),
662635
.direct(.canManageDirect),
663636
.direct(.canManageCalls),

submodules/TelegramApi/Sources/Api0.swift

Lines changed: 15 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -620,7 +620,7 @@ fileprivate let parsers: [Int32 : (BufferReader) -> Any?] = {
620620
dict[-1189364422] = { return Api.MessageAction.parse_messageActionSetChatTheme($0) }
621621
dict[1348510708] = { return Api.MessageAction.parse_messageActionSetChatWallPaper($0) }
622622
dict[1007897979] = { return Api.MessageAction.parse_messageActionSetMessagesTTL($0) }
623-
dict[-614898352] = { return Api.MessageAction.parse_messageActionStarGift($0) }
623+
dict[-366202413] = { return Api.MessageAction.parse_messageActionStarGift($0) }
624624
dict[2000845012] = { return Api.MessageAction.parse_messageActionStarGiftPurchaseOffer($0) }
625625
dict[1940760427] = { return Api.MessageAction.parse_messageActionStarGiftPurchaseOfferDeclined($0) }
626626
dict[-1787656893] = { return Api.MessageAction.parse_messageActionStarGiftUnique($0) }
@@ -915,7 +915,7 @@ fileprivate let parsers: [Int32 : (BufferReader) -> Any?] = {
915915
dict[1681948327] = { return Api.SavedDialog.parse_monoForumDialog($0) }
916916
dict[-1115174036] = { return Api.SavedDialog.parse_savedDialog($0) }
917917
dict[-881854424] = { return Api.SavedReactionTag.parse_savedReactionTag($0) }
918-
dict[-1987861422] = { return Api.SavedStarGift.parse_savedStarGift($0) }
918+
dict[-355041186] = { return Api.SavedStarGift.parse_savedStarGift($0) }
919919
dict[1040931690] = { return Api.SearchPostsFlood.parse_searchPostsFlood($0) }
920920
dict[-911191137] = { return Api.SearchResultsCalendarPeriod.parse_searchResultsCalendarPeriod($0) }
921921
dict[2137295719] = { return Api.SearchResultsPosition.parse_searchResultPosition($0) }
@@ -980,8 +980,8 @@ 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[463097215] = { return Api.StarGift.parse_starGift($0) }
984-
dict[-1624264554] = { return Api.StarGift.parse_starGiftUnique($0) }
983+
dict[1453798502] = { return Api.StarGift.parse_starGift($0) }
984+
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) }
987987
dict[970559507] = { return Api.StarGiftAttribute.parse_starGiftAttributeModel($0) }
@@ -991,8 +991,10 @@ fileprivate let parsers: [Int32 : (BufferReader) -> Any?] = {
991991
dict[520210263] = { return Api.StarGiftAttributeId.parse_starGiftAttributeIdBackdrop($0) }
992992
dict[1219145276] = { return Api.StarGiftAttributeId.parse_starGiftAttributeIdModel($0) }
993993
dict[1242965043] = { return Api.StarGiftAttributeId.parse_starGiftAttributeIdPattern($0) }
994-
dict[-1419714037] = { return Api.StarGiftAuctionAcquiredGift.parse_starGiftAuctionAcquiredGift($0) }
995-
dict[1571835723] = { return Api.StarGiftAuctionState.parse_starGiftAuctionState($0) }
994+
dict[1118831432] = { return Api.StarGiftAuctionAcquiredGift.parse_starGiftAuctionAcquiredGift($0) }
995+
dict[984483112] = { return Api.StarGiftAuctionRound.parse_starGiftAuctionRound($0) }
996+
dict[178266597] = { return Api.StarGiftAuctionRound.parse_starGiftAuctionRoundExtendable($0) }
997+
dict[1998212710] = { return Api.StarGiftAuctionState.parse_starGiftAuctionState($0) }
996998
dict[2107014202] = { return Api.StarGiftAuctionState.parse_starGiftAuctionStateFinished($0) }
997999
dict[-30197422] = { return Api.StarGiftAuctionState.parse_starGiftAuctionStateNotModified($0) }
9981000
dict[787403204] = { return Api.StarGiftAuctionUserState.parse_starGiftAuctionUserState($0) }
@@ -1493,12 +1495,13 @@ fileprivate let parsers: [Int32 : (BufferReader) -> Any?] = {
14931495
dict[-1803939105] = { return Api.payments.ResaleStarGifts.parse_resaleStarGifts($0) }
14941496
dict[-74456004] = { return Api.payments.SavedInfo.parse_savedInfo($0) }
14951497
dict[-1779201615] = { return Api.payments.SavedStarGifts.parse_savedStarGifts($0) }
1496-
dict[-1745778728] = { return Api.payments.StarGiftActiveAuctions.parse_starGiftActiveAuctions($0) }
1498+
dict[-1359565892] = { return Api.payments.StarGiftActiveAuctions.parse_starGiftActiveAuctions($0) }
14971499
dict[-617358640] = { return Api.payments.StarGiftActiveAuctions.parse_starGiftActiveAuctionsNotModified($0) }
14981500
dict[2103169520] = { return Api.payments.StarGiftAuctionAcquiredGifts.parse_starGiftAuctionAcquiredGifts($0) }
1499-
dict[244900980] = { return Api.payments.StarGiftAuctionState.parse_starGiftAuctionState($0) }
1501+
dict[1798960364] = { return Api.payments.StarGiftAuctionState.parse_starGiftAuctionState($0) }
15001502
dict[-1977011469] = { return Api.payments.StarGiftCollections.parse_starGiftCollections($0) }
15011503
dict[-1598402793] = { return Api.payments.StarGiftCollections.parse_starGiftCollectionsNotModified($0) }
1504+
dict[1187439471] = { return Api.payments.StarGiftUpgradeAttributes.parse_starGiftUpgradeAttributes($0) }
15021505
dict[1038213101] = { return Api.payments.StarGiftUpgradePreview.parse_starGiftUpgradePreview($0) }
15031506
dict[-2069218660] = { return Api.payments.StarGiftWithdrawalUrl.parse_starGiftWithdrawalUrl($0) }
15041507
dict[785918357] = { return Api.payments.StarGifts.parse_starGifts($0) }
@@ -2243,6 +2246,8 @@ public extension Api {
22432246
_1.serialize(buffer, boxed)
22442247
case let _1 as Api.StarGiftAuctionAcquiredGift:
22452248
_1.serialize(buffer, boxed)
2249+
case let _1 as Api.StarGiftAuctionRound:
2250+
_1.serialize(buffer, boxed)
22462251
case let _1 as Api.StarGiftAuctionState:
22472252
_1.serialize(buffer, boxed)
22482253
case let _1 as Api.StarGiftAuctionUserState:
@@ -2677,6 +2682,8 @@ public extension Api {
26772682
_1.serialize(buffer, boxed)
26782683
case let _1 as Api.payments.StarGiftCollections:
26792684
_1.serialize(buffer, boxed)
2685+
case let _1 as Api.payments.StarGiftUpgradeAttributes:
2686+
_1.serialize(buffer, boxed)
26802687
case let _1 as Api.payments.StarGiftUpgradePreview:
26812688
_1.serialize(buffer, boxed)
26822689
case let _1 as Api.payments.StarGiftWithdrawalUrl:

submodules/TelegramApi/Sources/Api15.swift

Lines changed: 11 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1069,7 +1069,7 @@ public extension Api {
10691069
case messageActionSetChatTheme(theme: Api.ChatTheme)
10701070
case messageActionSetChatWallPaper(flags: Int32, wallpaper: Api.WallPaper)
10711071
case messageActionSetMessagesTTL(flags: Int32, period: Int32, autoSettingFrom: Int64?)
1072-
case messageActionStarGift(flags: Int32, gift: Api.StarGift, message: Api.TextWithEntities?, convertStars: Int64?, upgradeMsgId: Int32?, upgradeStars: Int64?, fromId: Api.Peer?, peer: Api.Peer?, savedId: Int64?, prepaidUpgradeHash: String?, giftMsgId: Int32?, toId: Api.Peer?)
1072+
case messageActionStarGift(flags: Int32, gift: Api.StarGift, message: Api.TextWithEntities?, convertStars: Int64?, upgradeMsgId: Int32?, upgradeStars: Int64?, fromId: Api.Peer?, peer: Api.Peer?, savedId: Int64?, prepaidUpgradeHash: String?, giftMsgId: Int32?, toId: Api.Peer?, giftNum: Int32?)
10731073
case messageActionStarGiftPurchaseOffer(flags: Int32, gift: Api.StarGift, price: Api.StarsAmount, expiresAt: Int32)
10741074
case messageActionStarGiftPurchaseOfferDeclined(flags: Int32, gift: Api.StarGift, price: Api.StarsAmount)
10751075
case messageActionStarGiftUnique(flags: Int32, gift: Api.StarGift, canExportAt: Int32?, transferStars: Int64?, fromId: Api.Peer?, peer: Api.Peer?, savedId: Int64?, resaleAmount: Api.StarsAmount?, canTransferAt: Int32?, canResellAt: Int32?, dropOriginalDetailsStars: Int64?)
@@ -1462,9 +1462,9 @@ public extension Api {
14621462
serializeInt32(period, buffer: buffer, boxed: false)
14631463
if Int(flags) & Int(1 << 0) != 0 {serializeInt64(autoSettingFrom!, buffer: buffer, boxed: false)}
14641464
break
1465-
case .messageActionStarGift(let flags, let gift, let message, let convertStars, let upgradeMsgId, let upgradeStars, let fromId, let peer, let savedId, let prepaidUpgradeHash, let giftMsgId, let toId):
1465+
case .messageActionStarGift(let flags, let gift, let message, let convertStars, let upgradeMsgId, let upgradeStars, let fromId, let peer, let savedId, let prepaidUpgradeHash, let giftMsgId, let toId, let giftNum):
14661466
if boxed {
1467-
buffer.appendInt32(-614898352)
1467+
buffer.appendInt32(-366202413)
14681468
}
14691469
serializeInt32(flags, buffer: buffer, boxed: false)
14701470
gift.serialize(buffer, true)
@@ -1478,6 +1478,7 @@ public extension Api {
14781478
if Int(flags) & Int(1 << 14) != 0 {serializeString(prepaidUpgradeHash!, buffer: buffer, boxed: false)}
14791479
if Int(flags) & Int(1 << 15) != 0 {serializeInt32(giftMsgId!, buffer: buffer, boxed: false)}
14801480
if Int(flags) & Int(1 << 18) != 0 {toId!.serialize(buffer, true)}
1481+
if Int(flags) & Int(1 << 19) != 0 {serializeInt32(giftNum!, buffer: buffer, boxed: false)}
14811482
break
14821483
case .messageActionStarGiftPurchaseOffer(let flags, let gift, let price, let expiresAt):
14831484
if boxed {
@@ -1697,8 +1698,8 @@ public extension Api {
16971698
return ("messageActionSetChatWallPaper", [("flags", flags as Any), ("wallpaper", wallpaper as Any)])
16981699
case .messageActionSetMessagesTTL(let flags, let period, let autoSettingFrom):
16991700
return ("messageActionSetMessagesTTL", [("flags", flags as Any), ("period", period as Any), ("autoSettingFrom", autoSettingFrom as Any)])
1700-
case .messageActionStarGift(let flags, let gift, let message, let convertStars, let upgradeMsgId, let upgradeStars, let fromId, let peer, let savedId, let prepaidUpgradeHash, let giftMsgId, let toId):
1701-
return ("messageActionStarGift", [("flags", flags as Any), ("gift", gift as Any), ("message", message as Any), ("convertStars", convertStars as Any), ("upgradeMsgId", upgradeMsgId as Any), ("upgradeStars", upgradeStars as Any), ("fromId", fromId as Any), ("peer", peer as Any), ("savedId", savedId as Any), ("prepaidUpgradeHash", prepaidUpgradeHash as Any), ("giftMsgId", giftMsgId as Any), ("toId", toId as Any)])
1701+
case .messageActionStarGift(let flags, let gift, let message, let convertStars, let upgradeMsgId, let upgradeStars, let fromId, let peer, let savedId, let prepaidUpgradeHash, let giftMsgId, let toId, let giftNum):
1702+
return ("messageActionStarGift", [("flags", flags as Any), ("gift", gift as Any), ("message", message as Any), ("convertStars", convertStars as Any), ("upgradeMsgId", upgradeMsgId as Any), ("upgradeStars", upgradeStars as Any), ("fromId", fromId as Any), ("peer", peer as Any), ("savedId", savedId as Any), ("prepaidUpgradeHash", prepaidUpgradeHash as Any), ("giftMsgId", giftMsgId as Any), ("toId", toId as Any), ("giftNum", giftNum as Any)])
17021703
case .messageActionStarGiftPurchaseOffer(let flags, let gift, let price, let expiresAt):
17031704
return ("messageActionStarGiftPurchaseOffer", [("flags", flags as Any), ("gift", gift as Any), ("price", price as Any), ("expiresAt", expiresAt as Any)])
17041705
case .messageActionStarGiftPurchaseOfferDeclined(let flags, let gift, let price):
@@ -2477,6 +2478,8 @@ public extension Api {
24772478
if Int(_1!) & Int(1 << 18) != 0 {if let signature = reader.readInt32() {
24782479
_12 = Api.parse(reader, signature: signature) as? Api.Peer
24792480
} }
2481+
var _13: Int32?
2482+
if Int(_1!) & Int(1 << 19) != 0 {_13 = reader.readInt32() }
24802483
let _c1 = _1 != nil
24812484
let _c2 = _2 != nil
24822485
let _c3 = (Int(_1!) & Int(1 << 1) == 0) || _3 != nil
@@ -2489,8 +2492,9 @@ public extension Api {
24892492
let _c10 = (Int(_1!) & Int(1 << 14) == 0) || _10 != nil
24902493
let _c11 = (Int(_1!) & Int(1 << 15) == 0) || _11 != nil
24912494
let _c12 = (Int(_1!) & Int(1 << 18) == 0) || _12 != nil
2492-
if _c1 && _c2 && _c3 && _c4 && _c5 && _c6 && _c7 && _c8 && _c9 && _c10 && _c11 && _c12 {
2493-
return Api.MessageAction.messageActionStarGift(flags: _1!, gift: _2!, message: _3, convertStars: _4, upgradeMsgId: _5, upgradeStars: _6, fromId: _7, peer: _8, savedId: _9, prepaidUpgradeHash: _10, giftMsgId: _11, toId: _12)
2495+
let _c13 = (Int(_1!) & Int(1 << 19) == 0) || _13 != nil
2496+
if _c1 && _c2 && _c3 && _c4 && _c5 && _c6 && _c7 && _c8 && _c9 && _c10 && _c11 && _c12 && _c13 {
2497+
return Api.MessageAction.messageActionStarGift(flags: _1!, gift: _2!, message: _3, convertStars: _4, upgradeMsgId: _5, upgradeStars: _6, fromId: _7, peer: _8, savedId: _9, prepaidUpgradeHash: _10, giftMsgId: _11, toId: _12, giftNum: _13)
24942498
}
24952499
else {
24962500
return nil

0 commit comments

Comments
 (0)