Skip to content

Commit 2962851

Browse files
committed
Various improvements
1 parent 14064f9 commit 2962851

File tree

34 files changed

+1083
-505
lines changed

34 files changed

+1083
-505
lines changed

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

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14202,3 +14202,21 @@ Sorry for the inconvenience.";
1420214202
"Story.Privacy.KeepOnMyPageManyInfo" = "Keep these stories on your profile even after they expire in %@. Privacy settings will apply.";
1420314203
"Story.Privacy.KeepOnChannelPageManyInfo" = "Keep these stories on the channel profile even after they expire in %@.";
1420414204
"Story.Privacy.KeepOnGroupPageManyInfo" = "Keep these stories on the group page even after they expire in %@.";
14205+
14206+
"Gift.Options.Gift.Filter.Resale" = "Resale";
14207+
"Gift.Options.Gift.Resale" = "resale";
14208+
14209+
"Stars.Intro.Transaction.GiftPurchase" = "Gift Purchase";
14210+
"Stars.Intro.Transaction.GiftSale" = "Gift Sale";
14211+
14212+
"Stars.Transaction.GiftPurchase" = "Gift Purchase";
14213+
"Stars.Transaction.GiftSale" = "Gift Sale";
14214+
14215+
"Channel.Info.AutoTranslate" = "Auto-Translate Messages";
14216+
14217+
"ChannelBoost.Table.AutoTranslate" = "Autotranslation of Messages";
14218+
"ChannelBoost.AutoTranslate" = "Autotranslation of Messages";
14219+
"ChannelBoost.AutoTranslateLevelText" = "Your channel needs **Level %1$@** to enable autotranslation of messages.";
14220+
14221+
"Channel.AdminLog.MessageToggleAutoTranslateOn" = "%@ enabled autotranslation of messages";
14222+
"Channel.AdminLog.MessageToggleAutoTranslateOff" = "%@ disabled autotranslation of messages";

submodules/AccountContext/Sources/Premium.swift

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -125,6 +125,7 @@ public enum BoostSubject: Equatable {
125125
case emojiPack
126126
case noAds
127127
case wearGift
128+
case autoTranslate
128129
}
129130

130131
public enum StarsPurchasePurpose: Equatable {
@@ -164,6 +165,7 @@ public struct PremiumConfiguration {
164165
minChannelCustomWallpaperLevel: 10,
165166
minChannelRestrictAdsLevel: 50,
166167
minChannelWearGiftLevel: 8,
168+
minChannelAutoTranslateLevel: 3,
167169
minGroupProfileIconLevel: 7,
168170
minGroupEmojiStatusLevel: 8,
169171
minGroupWallpaperLevel: 9,
@@ -193,6 +195,7 @@ public struct PremiumConfiguration {
193195
public let minChannelCustomWallpaperLevel: Int32
194196
public let minChannelRestrictAdsLevel: Int32
195197
public let minChannelWearGiftLevel: Int32
198+
public let minChannelAutoTranslateLevel: Int32
196199
public let minGroupProfileIconLevel: Int32
197200
public let minGroupEmojiStatusLevel: Int32
198201
public let minGroupWallpaperLevel: Int32
@@ -221,6 +224,7 @@ public struct PremiumConfiguration {
221224
minChannelCustomWallpaperLevel: Int32,
222225
minChannelRestrictAdsLevel: Int32,
223226
minChannelWearGiftLevel: Int32,
227+
minChannelAutoTranslateLevel: Int32,
224228
minGroupProfileIconLevel: Int32,
225229
minGroupEmojiStatusLevel: Int32,
226230
minGroupWallpaperLevel: Int32,
@@ -248,6 +252,7 @@ public struct PremiumConfiguration {
248252
self.minChannelCustomWallpaperLevel = minChannelCustomWallpaperLevel
249253
self.minChannelRestrictAdsLevel = minChannelRestrictAdsLevel
250254
self.minChannelWearGiftLevel = minChannelWearGiftLevel
255+
self.minChannelAutoTranslateLevel = minChannelAutoTranslateLevel
251256
self.minGroupProfileIconLevel = minGroupProfileIconLevel
252257
self.minGroupEmojiStatusLevel = minGroupEmojiStatusLevel
253258
self.minGroupWallpaperLevel = minGroupWallpaperLevel
@@ -283,6 +288,7 @@ public struct PremiumConfiguration {
283288
minChannelCustomWallpaperLevel: get(data["channel_custom_wallpaper_level_min"]) ?? defaultValue.minChannelCustomWallpaperLevel,
284289
minChannelRestrictAdsLevel: get(data["channel_restrict_sponsored_level_min"]) ?? defaultValue.minChannelRestrictAdsLevel,
285290
minChannelWearGiftLevel: get(data["channel_emoji_status_level_min"]) ?? defaultValue.minChannelWearGiftLevel,
291+
minChannelAutoTranslateLevel: get(data["channel_autotranslation_level_min"]) ?? defaultValue.minChannelAutoTranslateLevel,
286292
minGroupProfileIconLevel: get(data["group_profile_bg_icon_level_min"]) ?? defaultValue.minGroupProfileIconLevel,
287293
minGroupEmojiStatusLevel: get(data["group_emoji_status_level_min"]) ?? defaultValue.minGroupEmojiStatusLevel,
288294
minGroupWallpaperLevel: get(data["group_wallpaper_level_min"]) ?? defaultValue.minGroupWallpaperLevel,

submodules/PremiumUI/Sources/PremiumBoostLevelsScreen.swift

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -61,6 +61,8 @@ func requiredBoostSubjectLevel(subject: BoostSubject, group: Bool, context: Acco
6161
return configuration.minChannelRestrictAdsLevel
6262
case .wearGift:
6363
return configuration.minChannelWearGiftLevel
64+
case .autoTranslate:
65+
return configuration.minChannelAutoTranslateLevel
6466
}
6567
}
6668

@@ -243,6 +245,7 @@ private final class LevelSectionComponent: CombinedComponent {
243245
case emojiPack
244246
case noAds
245247
case wearGift
248+
case autoTranslate
246249

247250
func title(strings: PresentationStrings, isGroup: Bool) -> String {
248251
switch self {
@@ -274,6 +277,8 @@ private final class LevelSectionComponent: CombinedComponent {
274277
return strings.ChannelBoost_Table_NoAds
275278
case .wearGift:
276279
return strings.ChannelBoost_Table_WearGift
280+
case .autoTranslate:
281+
return strings.ChannelBoost_Table_AutoTranslate
277282
}
278283
}
279284

@@ -307,6 +312,8 @@ private final class LevelSectionComponent: CombinedComponent {
307312
return "Premium/BoostPerk/NoAds"
308313
case .wearGift:
309314
return "Premium/BoostPerk/NoAds"
315+
case .autoTranslate:
316+
return "Chat/Title Panels/Translate"
310317
}
311318
}
312319
}
@@ -647,6 +654,8 @@ private final class SheetContent: CombinedComponent {
647654
textString = strings.ChannelBoost_EnableNoAdsLevelText("\(requiredLevel)").string
648655
case .wearGift:
649656
textString = strings.ChannelBoost_WearGiftLevelText("\(requiredLevel)").string
657+
case .autoTranslate:
658+
textString = strings.ChannelBoost_AutoTranslateLevelText("\(requiredLevel)").string
650659
}
651660
} else {
652661
let boostsString = strings.ChannelBoost_MoreBoostsNeeded_Boosts(Int32(remaining))
@@ -1162,6 +1171,9 @@ private final class SheetContent: CombinedComponent {
11621171
if !isGroup && level >= requiredBoostSubjectLevel(subject: .noAds, group: isGroup, context: component.context, configuration: premiumConfiguration) {
11631172
perks.append(.noAds)
11641173
}
1174+
if !isGroup && level >= requiredBoostSubjectLevel(subject: .autoTranslate, group: isGroup, context: component.context, configuration: premiumConfiguration) {
1175+
perks.append(.autoTranslate)
1176+
}
11651177
// if !isGroup && level >= requiredBoostSubjectLevel(subject: .wearGift, group: isGroup, context: component.context, configuration: premiumConfiguration) {
11661178
// perks.append(.wearGift)
11671179
// }
@@ -1466,6 +1478,8 @@ private final class BoostLevelsContainerComponent: CombinedComponent {
14661478
titleString = strings.ChannelBoost_NoAds
14671479
case .wearGift:
14681480
titleString = strings.ChannelBoost_WearGift
1481+
case .autoTranslate:
1482+
titleString = strings.ChannelBoost_AutoTranslate
14691483
}
14701484
} else {
14711485
titleString = isGroup == true ? strings.GroupBoost_Title_Current : strings.ChannelBoost_Title_Current

submodules/TelegramApi/Sources/Api0.swift

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -171,6 +171,7 @@ fileprivate let parsers: [Int32 : (BufferReader) -> Any?] = {
171171
dict[589338437] = { return Api.ChannelAdminLogEventAction.parse_channelAdminLogEventActionStartGroupCall($0) }
172172
dict[-1895328189] = { return Api.ChannelAdminLogEventAction.parse_channelAdminLogEventActionStopPoll($0) }
173173
dict[1693675004] = { return Api.ChannelAdminLogEventAction.parse_channelAdminLogEventActionToggleAntiSpam($0) }
174+
dict[-988285058] = { return Api.ChannelAdminLogEventAction.parse_channelAdminLogEventActionToggleAutotranslation($0) }
174175
dict[46949251] = { return Api.ChannelAdminLogEventAction.parse_channelAdminLogEventActionToggleForum($0) }
175176
dict[1456906823] = { return Api.ChannelAdminLogEventAction.parse_channelAdminLogEventActionToggleGroupCallSetting($0) }
176177
dict[460916654] = { return Api.ChannelAdminLogEventAction.parse_channelAdminLogEventActionToggleInvites($0) }
@@ -1461,6 +1462,7 @@ fileprivate let parsers: [Int32 : (BufferReader) -> Any?] = {
14611462
dict[276907596] = { return Api.storage.FileType.parse_fileWebp($0) }
14621463
dict[1862033025] = { return Api.stories.AllStories.parse_allStories($0) }
14631464
dict[291044926] = { return Api.stories.AllStories.parse_allStoriesNotModified($0) }
1465+
dict[-1014513586] = { return Api.stories.CanSendStoryCount.parse_canSendStoryCount($0) }
14641466
dict[-488736969] = { return Api.stories.FoundStories.parse_foundStories($0) }
14651467
dict[-890861720] = { return Api.stories.PeerStories.parse_peerStories($0) }
14661468
dict[1673780490] = { return Api.stories.Stories.parse_stories($0) }
@@ -2592,6 +2594,8 @@ public extension Api {
25922594
_1.serialize(buffer, boxed)
25932595
case let _1 as Api.stories.AllStories:
25942596
_1.serialize(buffer, boxed)
2597+
case let _1 as Api.stories.CanSendStoryCount:
2598+
_1.serialize(buffer, boxed)
25952599
case let _1 as Api.stories.FoundStories:
25962600
_1.serialize(buffer, boxed)
25972601
case let _1 as Api.stories.PeerStories:

submodules/TelegramApi/Sources/Api3.swift

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -605,6 +605,7 @@ public extension Api {
605605
case channelAdminLogEventActionStartGroupCall(call: Api.InputGroupCall)
606606
case channelAdminLogEventActionStopPoll(message: Api.Message)
607607
case channelAdminLogEventActionToggleAntiSpam(newValue: Api.Bool)
608+
case channelAdminLogEventActionToggleAutotranslation(newValue: Api.Bool)
608609
case channelAdminLogEventActionToggleForum(newValue: Api.Bool)
609610
case channelAdminLogEventActionToggleGroupCallSetting(joinMuted: Api.Bool)
610611
case channelAdminLogEventActionToggleInvites(newValue: Api.Bool)
@@ -897,6 +898,12 @@ public extension Api {
897898
}
898899
newValue.serialize(buffer, true)
899900
break
901+
case .channelAdminLogEventActionToggleAutotranslation(let newValue):
902+
if boxed {
903+
buffer.appendInt32(-988285058)
904+
}
905+
newValue.serialize(buffer, true)
906+
break
900907
case .channelAdminLogEventActionToggleForum(let newValue):
901908
if boxed {
902909
buffer.appendInt32(46949251)
@@ -1039,6 +1046,8 @@ public extension Api {
10391046
return ("channelAdminLogEventActionStopPoll", [("message", message as Any)])
10401047
case .channelAdminLogEventActionToggleAntiSpam(let newValue):
10411048
return ("channelAdminLogEventActionToggleAntiSpam", [("newValue", newValue as Any)])
1049+
case .channelAdminLogEventActionToggleAutotranslation(let newValue):
1050+
return ("channelAdminLogEventActionToggleAutotranslation", [("newValue", newValue as Any)])
10421051
case .channelAdminLogEventActionToggleForum(let newValue):
10431052
return ("channelAdminLogEventActionToggleForum", [("newValue", newValue as Any)])
10441053
case .channelAdminLogEventActionToggleGroupCallSetting(let joinMuted):
@@ -1677,6 +1686,19 @@ public extension Api {
16771686
return nil
16781687
}
16791688
}
1689+
public static func parse_channelAdminLogEventActionToggleAutotranslation(_ reader: BufferReader) -> ChannelAdminLogEventAction? {
1690+
var _1: Api.Bool?
1691+
if let signature = reader.readInt32() {
1692+
_1 = Api.parse(reader, signature: signature) as? Api.Bool
1693+
}
1694+
let _c1 = _1 != nil
1695+
if _c1 {
1696+
return Api.ChannelAdminLogEventAction.channelAdminLogEventActionToggleAutotranslation(newValue: _1!)
1697+
}
1698+
else {
1699+
return nil
1700+
}
1701+
}
16801702
public static func parse_channelAdminLogEventActionToggleForum(_ reader: BufferReader) -> ChannelAdminLogEventAction? {
16811703
var _1: Api.Bool?
16821704
if let signature = reader.readInt32() {

submodules/TelegramApi/Sources/Api36.swift

Lines changed: 36 additions & 52 deletions
Original file line numberDiff line numberDiff line change
@@ -760,6 +760,42 @@ public extension Api.stories {
760760

761761
}
762762
}
763+
public extension Api.stories {
764+
enum CanSendStoryCount: TypeConstructorDescription {
765+
case canSendStoryCount(countRemains: Int32)
766+
767+
public func serialize(_ buffer: Buffer, _ boxed: Swift.Bool) {
768+
switch self {
769+
case .canSendStoryCount(let countRemains):
770+
if boxed {
771+
buffer.appendInt32(-1014513586)
772+
}
773+
serializeInt32(countRemains, buffer: buffer, boxed: false)
774+
break
775+
}
776+
}
777+
778+
public func descriptionFields() -> (String, [(String, Any)]) {
779+
switch self {
780+
case .canSendStoryCount(let countRemains):
781+
return ("canSendStoryCount", [("countRemains", countRemains as Any)])
782+
}
783+
}
784+
785+
public static func parse_canSendStoryCount(_ reader: BufferReader) -> CanSendStoryCount? {
786+
var _1: Int32?
787+
_1 = reader.readInt32()
788+
let _c1 = _1 != nil
789+
if _c1 {
790+
return Api.stories.CanSendStoryCount.canSendStoryCount(countRemains: _1!)
791+
}
792+
else {
793+
return nil
794+
}
795+
}
796+
797+
}
798+
}
763799
public extension Api.stories {
764800
enum FoundStories: TypeConstructorDescription {
765801
case foundStories(flags: Int32, count: Int32, stories: [Api.FoundStory], nextOffset: String?, chats: [Api.Chat], users: [Api.User])
@@ -1560,55 +1596,3 @@ public extension Api.updates {
15601596

15611597
}
15621598
}
1563-
public extension Api.updates {
1564-
enum State: TypeConstructorDescription {
1565-
case state(pts: Int32, qts: Int32, date: Int32, seq: Int32, unreadCount: Int32)
1566-
1567-
public func serialize(_ buffer: Buffer, _ boxed: Swift.Bool) {
1568-
switch self {
1569-
case .state(let pts, let qts, let date, let seq, let unreadCount):
1570-
if boxed {
1571-
buffer.appendInt32(-1519637954)
1572-
}
1573-
serializeInt32(pts, buffer: buffer, boxed: false)
1574-
serializeInt32(qts, buffer: buffer, boxed: false)
1575-
serializeInt32(date, buffer: buffer, boxed: false)
1576-
serializeInt32(seq, buffer: buffer, boxed: false)
1577-
serializeInt32(unreadCount, buffer: buffer, boxed: false)
1578-
break
1579-
}
1580-
}
1581-
1582-
public func descriptionFields() -> (String, [(String, Any)]) {
1583-
switch self {
1584-
case .state(let pts, let qts, let date, let seq, let unreadCount):
1585-
return ("state", [("pts", pts as Any), ("qts", qts as Any), ("date", date as Any), ("seq", seq as Any), ("unreadCount", unreadCount as Any)])
1586-
}
1587-
}
1588-
1589-
public static func parse_state(_ reader: BufferReader) -> State? {
1590-
var _1: Int32?
1591-
_1 = reader.readInt32()
1592-
var _2: Int32?
1593-
_2 = reader.readInt32()
1594-
var _3: Int32?
1595-
_3 = reader.readInt32()
1596-
var _4: Int32?
1597-
_4 = reader.readInt32()
1598-
var _5: Int32?
1599-
_5 = reader.readInt32()
1600-
let _c1 = _1 != nil
1601-
let _c2 = _2 != nil
1602-
let _c3 = _3 != nil
1603-
let _c4 = _4 != nil
1604-
let _c5 = _5 != nil
1605-
if _c1 && _c2 && _c3 && _c4 && _c5 {
1606-
return Api.updates.State.state(pts: _1!, qts: _2!, date: _3!, seq: _4!, unreadCount: _5!)
1607-
}
1608-
else {
1609-
return nil
1610-
}
1611-
}
1612-
1613-
}
1614-
}

submodules/TelegramApi/Sources/Api37.swift

Lines changed: 52 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,55 @@
1+
public extension Api.updates {
2+
enum State: TypeConstructorDescription {
3+
case state(pts: Int32, qts: Int32, date: Int32, seq: Int32, unreadCount: Int32)
4+
5+
public func serialize(_ buffer: Buffer, _ boxed: Swift.Bool) {
6+
switch self {
7+
case .state(let pts, let qts, let date, let seq, let unreadCount):
8+
if boxed {
9+
buffer.appendInt32(-1519637954)
10+
}
11+
serializeInt32(pts, buffer: buffer, boxed: false)
12+
serializeInt32(qts, buffer: buffer, boxed: false)
13+
serializeInt32(date, buffer: buffer, boxed: false)
14+
serializeInt32(seq, buffer: buffer, boxed: false)
15+
serializeInt32(unreadCount, buffer: buffer, boxed: false)
16+
break
17+
}
18+
}
19+
20+
public func descriptionFields() -> (String, [(String, Any)]) {
21+
switch self {
22+
case .state(let pts, let qts, let date, let seq, let unreadCount):
23+
return ("state", [("pts", pts as Any), ("qts", qts as Any), ("date", date as Any), ("seq", seq as Any), ("unreadCount", unreadCount as Any)])
24+
}
25+
}
26+
27+
public static func parse_state(_ reader: BufferReader) -> State? {
28+
var _1: Int32?
29+
_1 = reader.readInt32()
30+
var _2: Int32?
31+
_2 = reader.readInt32()
32+
var _3: Int32?
33+
_3 = reader.readInt32()
34+
var _4: Int32?
35+
_4 = reader.readInt32()
36+
var _5: Int32?
37+
_5 = reader.readInt32()
38+
let _c1 = _1 != nil
39+
let _c2 = _2 != nil
40+
let _c3 = _3 != nil
41+
let _c4 = _4 != nil
42+
let _c5 = _5 != nil
43+
if _c1 && _c2 && _c3 && _c4 && _c5 {
44+
return Api.updates.State.state(pts: _1!, qts: _2!, date: _3!, seq: _4!, unreadCount: _5!)
45+
}
46+
else {
47+
return nil
48+
}
49+
}
50+
51+
}
52+
}
153
public extension Api.upload {
254
enum CdnFile: TypeConstructorDescription {
355
case cdnFile(bytes: Buffer)

0 commit comments

Comments
 (0)