This commit is contained in:
Ali 2023-03-17 13:04:14 +04:00
parent 3aec94b4b2
commit ad5e14bb79
4 changed files with 38 additions and 23 deletions

View File

@ -75,6 +75,7 @@ private enum ChatListFilterPresetListEntry: ItemListNodeEntry {
case suggestedPreset(index: PresetIndex, title: String, label: String, preset: ChatListFilterData)
case suggestedAddCustom(String)
case listHeader(String)
case addFolder
case preset(index: PresetIndex, title: String, label: String, preset: ChatListFilter, canBeReordered: Bool, canBeDeleted: Bool, isEditing: Bool, isAllChats: Bool, isDisabled: Bool)
case addItem(text: String, isEditing: Bool)
case listFooter(String)
@ -85,7 +86,7 @@ private enum ChatListFilterPresetListEntry: ItemListNodeEntry {
return ChatListFilterPresetListSection.screenHeader.rawValue
case .suggestedListHeader, .suggestedPreset, .suggestedAddCustom:
return ChatListFilterPresetListSection.suggested.rawValue
case .listHeader, .preset, .addItem, .listFooter:
case .listHeader, .addFolder, .preset, .addItem, .listFooter:
return ChatListFilterPresetListSection.list.rawValue
}
}
@ -96,10 +97,10 @@ private enum ChatListFilterPresetListEntry: ItemListNodeEntry {
return 0
case .listHeader:
return 100
case let .preset(index, _, _, _, _, _, _, _, _):
return 101 + index.value
case .addItem:
return 1000
return 101
case let .preset(index, _, _, _, _, _, _, _, _):
return 102 + index.value
case .listFooter:
return 1001
case .suggestedListHeader:
@ -219,9 +220,13 @@ private func chatListFilterPresetListControllerEntries(presentationData: Present
return true
}
entries.append(.listHeader(presentationData.strings.ChatListFolderSettings_FoldersSection))
//TODO:localize
entries.append(.addItem(text: "Create a Folder", isEditing: state.isEditing))
if !filters.isEmpty || suggestedFilters.isEmpty {
entries.append(.listHeader(presentationData.strings.ChatListFolderSettings_FoldersSection))
var folderCount = 0
for (filter, chatCount) in filtersWithAppliedOrder(filters: filters, order: updatedFilterOrder) {
if case .allChats = filter {
@ -233,8 +238,6 @@ private func chatListFilterPresetListControllerEntries(presentationData: Present
}
}
entries.append(.addItem(text: presentationData.strings.ChatListFolderSettings_NewFolder, isEditing: state.isEditing))
entries.append(.listFooter(presentationData.strings.ChatListFolderSettings_EditFoldersInfo))
}

View File

@ -456,7 +456,7 @@ fileprivate let parsers: [Int32 : (BufferReader) -> Any?] = {
dict[-1230047312] = { return Api.MessageAction.parse_messageActionEmpty($0) }
dict[-1834538890] = { return Api.MessageAction.parse_messageActionGameScore($0) }
dict[-1730095465] = { return Api.MessageAction.parse_messageActionGeoProximityReached($0) }
dict[-1415514682] = { return Api.MessageAction.parse_messageActionGiftPremium($0) }
dict[-935499028] = { return Api.MessageAction.parse_messageActionGiftPremium($0) }
dict[2047704898] = { return Api.MessageAction.parse_messageActionGroupCall($0) }
dict[-1281329567] = { return Api.MessageAction.parse_messageActionGroupCallScheduled($0) }
dict[-1615153660] = { return Api.MessageAction.parse_messageActionHistoryClear($0) }

View File

@ -247,7 +247,7 @@ public extension Api {
case messageActionEmpty
case messageActionGameScore(gameId: Int64, score: Int32)
case messageActionGeoProximityReached(fromId: Api.Peer, toId: Api.Peer, distance: Int32)
case messageActionGiftPremium(currency: String, amount: Int64, months: Int32)
case messageActionGiftPremium(flags: Int32, currency: String, amount: Int64, months: Int32, cryptoCurrency: String?, cryptoAmount: Int64?)
case messageActionGroupCall(flags: Int32, call: Api.InputGroupCall, duration: Int32?)
case messageActionGroupCallScheduled(call: Api.InputGroupCall, scheduleDate: Int32)
case messageActionHistoryClear
@ -387,13 +387,16 @@ public extension Api {
toId.serialize(buffer, true)
serializeInt32(distance, buffer: buffer, boxed: false)
break
case .messageActionGiftPremium(let currency, let amount, let months):
case .messageActionGiftPremium(let flags, let currency, let amount, let months, let cryptoCurrency, let cryptoAmount):
if boxed {
buffer.appendInt32(-1415514682)
buffer.appendInt32(-935499028)
}
serializeInt32(flags, buffer: buffer, boxed: false)
serializeString(currency, buffer: buffer, boxed: false)
serializeInt64(amount, buffer: buffer, boxed: false)
serializeInt32(months, buffer: buffer, boxed: false)
if Int(flags) & Int(1 << 0) != 0 {serializeString(cryptoCurrency!, buffer: buffer, boxed: false)}
if Int(flags) & Int(1 << 0) != 0 {serializeInt64(cryptoAmount!, buffer: buffer, boxed: false)}
break
case .messageActionGroupCall(let flags, let call, let duration):
if boxed {
@ -588,8 +591,8 @@ public extension Api {
return ("messageActionGameScore", [("gameId", gameId as Any), ("score", score as Any)])
case .messageActionGeoProximityReached(let fromId, let toId, let distance):
return ("messageActionGeoProximityReached", [("fromId", fromId as Any), ("toId", toId as Any), ("distance", distance as Any)])
case .messageActionGiftPremium(let currency, let amount, let months):
return ("messageActionGiftPremium", [("currency", currency as Any), ("amount", amount as Any), ("months", months as Any)])
case .messageActionGiftPremium(let flags, let currency, let amount, let months, let cryptoCurrency, let cryptoAmount):
return ("messageActionGiftPremium", [("flags", flags as Any), ("currency", currency as Any), ("amount", amount as Any), ("months", months as Any), ("cryptoCurrency", cryptoCurrency as Any), ("cryptoAmount", cryptoAmount as Any)])
case .messageActionGroupCall(let flags, let call, let duration):
return ("messageActionGroupCall", [("flags", flags as Any), ("call", call as Any), ("duration", duration as Any)])
case .messageActionGroupCallScheduled(let call, let scheduleDate):
@ -820,17 +823,26 @@ public extension Api {
}
}
public static func parse_messageActionGiftPremium(_ reader: BufferReader) -> MessageAction? {
var _1: String?
_1 = parseString(reader)
var _2: Int64?
_2 = reader.readInt64()
var _3: Int32?
_3 = reader.readInt32()
var _1: Int32?
_1 = reader.readInt32()
var _2: String?
_2 = parseString(reader)
var _3: Int64?
_3 = reader.readInt64()
var _4: Int32?
_4 = reader.readInt32()
var _5: String?
if Int(_1!) & Int(1 << 0) != 0 {_5 = parseString(reader) }
var _6: Int64?
if Int(_1!) & Int(1 << 0) != 0 {_6 = reader.readInt64() }
let _c1 = _1 != nil
let _c2 = _2 != nil
let _c3 = _3 != nil
if _c1 && _c2 && _c3 {
return Api.MessageAction.messageActionGiftPremium(currency: _1!, amount: _2!, months: _3!)
let _c4 = _4 != nil
let _c5 = (Int(_1!) & Int(1 << 0) == 0) || _5 != nil
let _c6 = (Int(_1!) & Int(1 << 0) == 0) || _6 != nil
if _c1 && _c2 && _c3 && _c4 && _c5 && _c6 {
return Api.MessageAction.messageActionGiftPremium(flags: _1!, currency: _2!, amount: _3!, months: _4!, cryptoCurrency: _5, cryptoAmount: _6)
}
else {
return nil

View File

@ -85,7 +85,7 @@ func telegramMediaActionFromApiAction(_ action: Api.MessageAction) -> TelegramMe
return TelegramMediaAction(action: .joinedByRequest)
case let .messageActionWebViewDataSentMe(text, _), let .messageActionWebViewDataSent(text):
return TelegramMediaAction(action: .webViewData(text))
case let .messageActionGiftPremium(currency, amount, months):
case let .messageActionGiftPremium(_, currency, amount, months, _, _):
return TelegramMediaAction(action: .giftPremium(currency: currency, amount: amount, months: months))
case let .messageActionTopicCreate(_, title, iconColor, iconEmojiId):
return TelegramMediaAction(action: .topicCreated(title: title, iconColor: iconColor, iconFileId: iconEmojiId))