mirror of
https://github.com/Swiftgram/Telegram-iOS.git
synced 2025-12-03 13:13:55 +00:00
no message
This commit is contained in:
parent
a78c348248
commit
f4758d0b0d
@ -100,6 +100,8 @@
|
||||
D00DBBD81E64E41100DB5485 /* CreateSecretChat.swift in Sources */ = {isa = PBXBuildFile; fileRef = D00DBBD61E64E41100DB5485 /* CreateSecretChat.swift */; };
|
||||
D00DBBDA1E64E67E00DB5485 /* UpdateSecretChat.swift in Sources */ = {isa = PBXBuildFile; fileRef = D00DBBD91E64E67E00DB5485 /* UpdateSecretChat.swift */; };
|
||||
D00DBBDB1E64E67E00DB5485 /* UpdateSecretChat.swift in Sources */ = {isa = PBXBuildFile; fileRef = D00DBBD91E64E67E00DB5485 /* UpdateSecretChat.swift */; };
|
||||
D0119CB020CA9EA800895300 /* MarkAllChatsAsRead.swift in Sources */ = {isa = PBXBuildFile; fileRef = D0119CAF20CA9EA800895300 /* MarkAllChatsAsRead.swift */; };
|
||||
D0119CB120CA9EA800895300 /* MarkAllChatsAsRead.swift in Sources */ = {isa = PBXBuildFile; fileRef = D0119CAF20CA9EA800895300 /* MarkAllChatsAsRead.swift */; };
|
||||
D0136309208F3B0900EB3653 /* SecureIdValueContentError.swift in Sources */ = {isa = PBXBuildFile; fileRef = D0136308208F3B0900EB3653 /* SecureIdValueContentError.swift */; };
|
||||
D013630A208F6E2800EB3653 /* SecureIdValueContentError.swift in Sources */ = {isa = PBXBuildFile; fileRef = D0136308208F3B0900EB3653 /* SecureIdValueContentError.swift */; };
|
||||
D01749591E1092BC0057C89A /* RequestStartBot.swift in Sources */ = {isa = PBXBuildFile; fileRef = D01749581E1092BC0057C89A /* RequestStartBot.swift */; };
|
||||
@ -761,6 +763,7 @@
|
||||
D00D97C91E32917C00E5C2B6 /* PeerInputActivityManager.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = PeerInputActivityManager.swift; sourceTree = "<group>"; };
|
||||
D00DBBD61E64E41100DB5485 /* CreateSecretChat.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = CreateSecretChat.swift; sourceTree = "<group>"; };
|
||||
D00DBBD91E64E67E00DB5485 /* UpdateSecretChat.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = UpdateSecretChat.swift; sourceTree = "<group>"; };
|
||||
D0119CAF20CA9EA800895300 /* MarkAllChatsAsRead.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = MarkAllChatsAsRead.swift; sourceTree = "<group>"; };
|
||||
D0136308208F3B0900EB3653 /* SecureIdValueContentError.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = SecureIdValueContentError.swift; sourceTree = "<group>"; };
|
||||
D01749581E1092BC0057C89A /* RequestStartBot.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = RequestStartBot.swift; sourceTree = "<group>"; };
|
||||
D017495D1E118F790057C89A /* AccountStateManager.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = AccountStateManager.swift; sourceTree = "<group>"; };
|
||||
@ -1519,6 +1522,7 @@
|
||||
D0DB7F021F43030C00591D48 /* InstallInteractiveReadMessagesAction.swift */,
|
||||
D0B85AC41F6B2B9400B8B5CE /* RecentlyUsedHashtags.swift */,
|
||||
D0E8B8B22044706300605593 /* ForwardGame.swift */,
|
||||
D0119CAF20CA9EA800895300 /* MarkAllChatsAsRead.swift */,
|
||||
);
|
||||
name = Messages;
|
||||
sourceTree = "<group>";
|
||||
@ -2198,6 +2202,7 @@
|
||||
D08F4A691E79CECB00A2AA15 /* ManagedSynchronizeInstalledStickerPacksOperations.swift in Sources */,
|
||||
D0575AF11E9FFA5D006F2541 /* SynchronizeSavedGifsOperation.swift in Sources */,
|
||||
D07047B41F3DF1FE00F6A8D4 /* ConsumablePersonalMentionMessageAttribute.swift in Sources */,
|
||||
D0119CB020CA9EA800895300 /* MarkAllChatsAsRead.swift in Sources */,
|
||||
D0FA8BB91E2240B4001E855B /* SecretChatIncomingDecryptedOperation.swift in Sources */,
|
||||
D0561DE31E5737FC00E6B9E9 /* UpdatePeerInfo.swift in Sources */,
|
||||
D0DF0C8A1D819C7E008AEB01 /* JoinChannel.swift in Sources */,
|
||||
@ -2406,6 +2411,7 @@
|
||||
D0B418B81D7E05A6004562A4 /* ContactManagement.swift in Sources */,
|
||||
D0E23DE01E8082A400B9B6D2 /* ArchivedStickerPacks.swift in Sources */,
|
||||
D02D60AC206BA64100FEFE1E /* VerifySecureIdValue.swift in Sources */,
|
||||
D0119CB120CA9EA800895300 /* MarkAllChatsAsRead.swift in Sources */,
|
||||
D050F2521E4A59C200988324 /* JoinLink.swift in Sources */,
|
||||
D018EE0320458E1E00CBB130 /* SecretChatLayerNegotiation.swift in Sources */,
|
||||
D0F7B1E91E045C87007EB8A5 /* PeerCommands.swift in Sources */,
|
||||
|
||||
@ -50,7 +50,7 @@ func decryptedSecureSecret(encryptedSecretData: Data, password: String, salt: Da
|
||||
let iv = passwordHash.subdata(in: 32 ..< (32 + 16))
|
||||
|
||||
guard let decryptedSecret = CryptoAES(false, secretKey, iv, encryptedSecretData) else {
|
||||
return nil;
|
||||
return nil
|
||||
}
|
||||
|
||||
if !verifySecureSecret(decryptedSecret) {
|
||||
|
||||
@ -359,10 +359,10 @@ public func twoStepAuthData(_ network: Network) -> Signal<TwoStepAuthData, MTRpc
|
||||
return network.request(Api.functions.account.getPassword())
|
||||
|> map { config -> TwoStepAuthData in
|
||||
switch config {
|
||||
case let .noPassword(newSalt, emailUnconfirmedPattern):
|
||||
return TwoStepAuthData(nextSalt: newSalt.makeData(), currentSalt: nil, hasRecovery: false, hasSecretValues: false, currentHint: nil, unconfirmedEmailPattern: emailUnconfirmedPattern, secretRandom: Data(), nextSecureSalt: Data())
|
||||
case let .password(currentSalt, newSalt, hint, hasRecovery, emailUnconfirmedPattern):
|
||||
return TwoStepAuthData(nextSalt: newSalt.makeData(), currentSalt: currentSalt.makeData(), hasRecovery: hasRecovery == .boolTrue, hasSecretValues: false, currentHint: hint, unconfirmedEmailPattern: emailUnconfirmedPattern, secretRandom: Data(), nextSecureSalt: Data())
|
||||
case let .noPassword(newSalt, newSecureSalt, secretRandom, emailUnconfirmedPattern):
|
||||
return TwoStepAuthData(nextSalt: newSalt.makeData(), currentSalt: nil, hasRecovery: false, hasSecretValues: false, currentHint: nil, unconfirmedEmailPattern: emailUnconfirmedPattern, secretRandom: secretRandom.makeData(), nextSecureSalt: newSecureSalt.makeData())
|
||||
case let .password(flags, currentSalt, newSalt, newSecureSalt, secretRandom, hint, emailUnconfirmedPattern):
|
||||
return TwoStepAuthData(nextSalt: newSalt.makeData(), currentSalt: currentSalt.makeData(), hasRecovery: (flags & (1 << 0)) != 0, hasSecretValues: (flags & (1 << 1)) != 0, currentHint: hint, unconfirmedEmailPattern: emailUnconfirmedPattern, secretRandom: secretRandom.makeData(), nextSecureSalt: newSecureSalt.makeData())
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@ -62,7 +62,8 @@ enum AccountStateMutationOperation {
|
||||
case UpdateMedia(MediaId, Media?)
|
||||
case ReadInbox(MessageId)
|
||||
case ReadOutbox(MessageId)
|
||||
case ResetReadState(PeerId, MessageId.Namespace, MessageId.Id, MessageId.Id, MessageId.Id, Int32)
|
||||
case ResetReadState(PeerId, MessageId.Namespace, MessageId.Id, MessageId.Id, MessageId.Id, Int32, Bool?)
|
||||
case UpdatePeerChatUnreadMark(PeerId, MessageId.Namespace, Bool)
|
||||
case ResetMessageTagSummary(PeerId, MessageId.Namespace, Int32, MessageHistoryTagNamespaceCountValidityRange)
|
||||
case ReadGroupFeedInbox(PeerGroupId, MessageIndex)
|
||||
case UpdateState(AuthorizedAccountState.State)
|
||||
@ -201,8 +202,12 @@ struct AccountMutableState {
|
||||
self.addOperation(.ReadGroupFeedInbox(groupId, index))
|
||||
}
|
||||
|
||||
mutating func resetReadState(_ peerId: PeerId, namespace: MessageId.Namespace, maxIncomingReadId: MessageId.Id, maxOutgoingReadId: MessageId.Id, maxKnownId: MessageId.Id, count: Int32) {
|
||||
self.addOperation(.ResetReadState(peerId, namespace, maxIncomingReadId, maxOutgoingReadId, maxKnownId, count))
|
||||
mutating func resetReadState(_ peerId: PeerId, namespace: MessageId.Namespace, maxIncomingReadId: MessageId.Id, maxOutgoingReadId: MessageId.Id, maxKnownId: MessageId.Id, count: Int32, markedUnread: Bool?) {
|
||||
self.addOperation(.ResetReadState(peerId, namespace, maxIncomingReadId, maxOutgoingReadId, maxKnownId, count, markedUnread))
|
||||
}
|
||||
|
||||
mutating func updatePeerChatUnreadMark(_ peerId: PeerId, namespace: MessageId.Namespace, value: Bool) {
|
||||
self.addOperation(.UpdatePeerChatUnreadMark(peerId, namespace, value))
|
||||
}
|
||||
|
||||
mutating func resetMessageTagSummary(_ peerId: PeerId, namespace: MessageId.Namespace, count: Int32, range: MessageHistoryTagNamespaceCountValidityRange) {
|
||||
@ -322,7 +327,7 @@ struct AccountMutableState {
|
||||
|
||||
mutating func addOperation(_ operation: AccountStateMutationOperation) {
|
||||
switch operation {
|
||||
case .DeleteMessages, .DeleteMessagesWithGlobalIds, .EditMessage, .UpdateMedia, .ReadOutbox, .ReadGroupFeedInbox, .MergePeerPresences, .UpdateSecretChat, .AddSecretMessages, .ReadSecretOutbox, .AddPeerInputActivity, .UpdateCachedPeerData, .UpdatePinnedItemIds, .ReadMessageContents, .UpdateMessageImpressionCount, .UpdateInstalledStickerPacks, .UpdateRecentGifs, .UpdateChatInputState, .UpdateCall, .UpdateLangPack, .UpdateMinAvailableMessage:
|
||||
case .DeleteMessages, .DeleteMessagesWithGlobalIds, .EditMessage, .UpdateMedia, .ReadOutbox, .ReadGroupFeedInbox, .MergePeerPresences, .UpdateSecretChat, .AddSecretMessages, .ReadSecretOutbox, .AddPeerInputActivity, .UpdateCachedPeerData, .UpdatePinnedItemIds, .ReadMessageContents, .UpdateMessageImpressionCount, .UpdateInstalledStickerPacks, .UpdateRecentGifs, .UpdateChatInputState, .UpdateCall, .UpdateLangPack, .UpdateMinAvailableMessage, .UpdatePeerChatUnreadMark:
|
||||
break
|
||||
case let .AddMessages(messages, _):
|
||||
for message in messages {
|
||||
@ -365,7 +370,7 @@ struct AccountMutableState {
|
||||
if current == nil || current! < messageId {
|
||||
self.readInboxMaxIds[messageId.peerId] = messageId
|
||||
}
|
||||
case let .ResetReadState(peerId, namespace, maxIncomingReadId, _, _, _):
|
||||
case let .ResetReadState(peerId, namespace, maxIncomingReadId, _, _, _, _):
|
||||
let current = self.readInboxMaxIds[peerId]
|
||||
if namespace == Namespaces.Message.Cloud {
|
||||
if current == nil || current!.id < maxIncomingReadId {
|
||||
|
||||
@ -305,7 +305,7 @@ private func initialStateWithPeerIds(_ modifier: Modifier, peerIds: Set<PeerId>,
|
||||
if namespace == Namespaces.Message.Cloud {
|
||||
cloudReadStates[peerId] = state
|
||||
switch state {
|
||||
case let .idBased(maxIncomingReadId, _, _, _):
|
||||
case let .idBased(maxIncomingReadId, _, _, _, _):
|
||||
readInboxMaxIds[peerId] = MessageId(peerId: peerId, namespace: Namespaces.Message.Cloud, id: maxIncomingReadId)
|
||||
case .indexBased:
|
||||
break
|
||||
@ -840,6 +840,13 @@ private func finalStateWithUpdatesAndServerTime(account: Account, state: Account
|
||||
updatedState.readInbox(MessageId(peerId: peer.peerId, namespace: Namespaces.Message.Cloud, id: maxId))
|
||||
case let .updateReadHistoryOutbox(peer, maxId, _, _):
|
||||
updatedState.readOutbox(MessageId(peerId: peer.peerId, namespace: Namespaces.Message.Cloud, id: maxId))
|
||||
case let .updateDialogUnreadMark(flags, peer):
|
||||
let peerId: PeerId
|
||||
switch peer {
|
||||
case let .dialogPeer(peer):
|
||||
peerId = peer.peerId
|
||||
}
|
||||
updatedState.updatePeerChatUnreadMark(peerId, namespace: Namespaces.Message.Cloud, value: (flags & (1 << 0)) != 0)
|
||||
/*feed*/
|
||||
/*case let .updateReadFeed(_, feedId, maxPosition, unreadCount, unreadMutedCount):
|
||||
switch maxPosition {
|
||||
@ -1288,8 +1295,8 @@ private func resolveMissingPeerCloudReadStates(account: Account, state: AccountM
|
||||
var updatedState = state
|
||||
for pair in peersAndSettings {
|
||||
if let (peerId, state) = pair {
|
||||
if case let .idBased(maxIncomingReadId, maxOutgoingReadId, maxKnownId, count) = state {
|
||||
updatedState.resetReadState(peerId, namespace: Namespaces.Message.Cloud, maxIncomingReadId: maxIncomingReadId, maxOutgoingReadId: maxOutgoingReadId, maxKnownId: maxKnownId, count: count)
|
||||
if case let .idBased(maxIncomingReadId, maxOutgoingReadId, maxKnownId, count, markedUnread) = state {
|
||||
updatedState.resetReadState(peerId, namespace: Namespaces.Message.Cloud, maxIncomingReadId: maxIncomingReadId, maxOutgoingReadId: maxOutgoingReadId, maxKnownId: maxKnownId, count: count, markedUnread: markedUnread)
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -1376,13 +1383,15 @@ private func resetChannels(_ account: Account, peers: [Peer], state: AccountMuta
|
||||
let apiUnreadMentionsCount: Int32
|
||||
var apiChannelPts: Int32?
|
||||
let apiNotificationSettings: Api.PeerNotifySettings
|
||||
let apiMarkedUnread: Bool
|
||||
switch dialog {
|
||||
case let .dialog(_, peer, topMessage, readInboxMaxId, readOutboxMaxId, unreadCount, unreadMentionsCount, peerNotificationSettings, pts, _):
|
||||
case let .dialog(flags, peer, topMessage, readInboxMaxId, readOutboxMaxId, unreadCount, unreadMentionsCount, peerNotificationSettings, pts, _):
|
||||
apiPeer = peer
|
||||
apiTopMessage = topMessage
|
||||
apiReadInboxMaxId = readInboxMaxId
|
||||
apiReadOutboxMaxId = readOutboxMaxId
|
||||
apiUnreadCount = unreadCount
|
||||
apiMarkedUnread = (flags & (1 << 3)) != 0
|
||||
apiUnreadMentionsCount = unreadMentionsCount
|
||||
apiNotificationSettings = peerNotificationSettings
|
||||
apiChannelPts = pts
|
||||
@ -1405,7 +1414,7 @@ private func resetChannels(_ account: Account, peers: [Peer], state: AccountMuta
|
||||
if readStates[peerId] == nil {
|
||||
readStates[peerId] = [:]
|
||||
}
|
||||
readStates[peerId]![Namespaces.Message.Cloud] = .idBased(maxIncomingReadId: apiReadInboxMaxId, maxOutgoingReadId: apiReadOutboxMaxId, maxKnownId: apiTopMessage, count: apiUnreadCount)
|
||||
readStates[peerId]![Namespaces.Message.Cloud] = .idBased(maxIncomingReadId: apiReadInboxMaxId, maxOutgoingReadId: apiReadOutboxMaxId, maxKnownId: apiTopMessage, count: apiUnreadCount, markedUnread: apiMarkedUnread)
|
||||
|
||||
if apiTopMessage != 0 {
|
||||
mentionTagSummaries[peerId] = MessageHistoryTagNamespaceSummary(version: 1, count: apiUnreadMentionsCount, range: MessageHistoryTagNamespaceCountValidityRange(maxId: apiTopMessage))
|
||||
@ -1448,8 +1457,8 @@ private func resetChannels(_ account: Account, peers: [Peer], state: AccountMuta
|
||||
for (peerId, peerReadStates) in readStates {
|
||||
for (namespace, state) in peerReadStates {
|
||||
switch state {
|
||||
case let .idBased(maxIncomingReadId, maxOutgoingReadId, maxKnownId, count):
|
||||
updatedState.resetReadState(peerId, namespace: namespace, maxIncomingReadId: maxIncomingReadId, maxOutgoingReadId: maxOutgoingReadId, maxKnownId: maxKnownId, count: count)
|
||||
case let .idBased(maxIncomingReadId, maxOutgoingReadId, maxKnownId, count, markedUnread):
|
||||
updatedState.resetReadState(peerId, namespace: namespace, maxIncomingReadId: maxIncomingReadId, maxOutgoingReadId: maxOutgoingReadId, maxKnownId: maxKnownId, count: count, markedUnread: markedUnread)
|
||||
default:
|
||||
assertionFailure()
|
||||
break
|
||||
@ -1621,7 +1630,7 @@ private func pollChannel(_ account: Account, peer: Peer, state: AccountMutableSt
|
||||
}
|
||||
}
|
||||
|
||||
updatedState.resetReadState(peer.id, namespace: Namespaces.Message.Cloud, maxIncomingReadId: readInboxMaxId, maxOutgoingReadId: readOutboxMaxId, maxKnownId: topMessage, count: unreadCount)
|
||||
updatedState.resetReadState(peer.id, namespace: Namespaces.Message.Cloud, maxIncomingReadId: readInboxMaxId, maxOutgoingReadId: readOutboxMaxId, maxKnownId: topMessage, count: unreadCount, markedUnread: nil)
|
||||
|
||||
updatedState.resetMessageTagSummary(peer.id, namespace: Namespaces.Message.Cloud, count: unreadMentionsCount, range: MessageHistoryTagNamespaceCountValidityRange(maxId: topMessage))
|
||||
}
|
||||
@ -1728,7 +1737,7 @@ private func optimizedOperations(_ operations: [AccountStateMutationOperation])
|
||||
var currentAddMessages: OptimizeAddMessagesState?
|
||||
for operation in operations {
|
||||
switch operation {
|
||||
case .DeleteMessages, .DeleteMessagesWithGlobalIds, .EditMessage, .UpdateMedia, .MergeApiChats, .MergeApiUsers, .MergePeerPresences, .UpdatePeer, .ReadInbox, .ReadOutbox, .ReadGroupFeedInbox, .ResetReadState, .ResetMessageTagSummary, .UpdateNotificationSettings, .UpdateGlobalNotificationSettings, .UpdateSecretChat, .AddSecretMessages, .ReadSecretOutbox, .AddPeerInputActivity, .UpdateCachedPeerData, .UpdatePinnedItemIds, .ReadMessageContents, .UpdateMessageImpressionCount, .UpdateInstalledStickerPacks, .UpdateRecentGifs, .UpdateChatInputState, .UpdateCall, .UpdateLangPack, .UpdateMinAvailableMessage:
|
||||
case .DeleteMessages, .DeleteMessagesWithGlobalIds, .EditMessage, .UpdateMedia, .MergeApiChats, .MergeApiUsers, .MergePeerPresences, .UpdatePeer, .ReadInbox, .ReadOutbox, .ReadGroupFeedInbox, .ResetReadState, .UpdatePeerChatUnreadMark, .ResetMessageTagSummary, .UpdateNotificationSettings, .UpdateGlobalNotificationSettings, .UpdateSecretChat, .AddSecretMessages, .ReadSecretOutbox, .AddPeerInputActivity, .UpdateCachedPeerData, .UpdatePinnedItemIds, .ReadMessageContents, .UpdateMessageImpressionCount, .UpdateInstalledStickerPacks, .UpdateRecentGifs, .UpdateChatInputState, .UpdateCall, .UpdateLangPack, .UpdateMinAvailableMessage:
|
||||
if let currentAddMessages = currentAddMessages, !currentAddMessages.messages.isEmpty {
|
||||
result.append(.AddMessages(currentAddMessages.messages, currentAddMessages.location))
|
||||
}
|
||||
@ -1908,8 +1917,21 @@ func replayFinalState(accountPeerId: PeerId, mediaBox: MediaBox, modifier: Modif
|
||||
modifier.applyOutgoingReadMaxId(messageId)
|
||||
case let .ReadGroupFeedInbox(groupId, index):
|
||||
modifier.applyGroupFeedReadMaxIndex(groupId: groupId, index: index)
|
||||
case let .ResetReadState(peerId, namespace, maxIncomingReadId, maxOutgoingReadId, maxKnownId, count):
|
||||
modifier.resetIncomingReadStates([peerId: [namespace: .idBased(maxIncomingReadId: maxIncomingReadId, maxOutgoingReadId: maxOutgoingReadId, maxKnownId: maxKnownId, count: count)]])
|
||||
case let .ResetReadState(peerId, namespace, maxIncomingReadId, maxOutgoingReadId, maxKnownId, count, markedUnread):
|
||||
var markedUnreadValue: Bool = false
|
||||
if let markedUnread = markedUnread {
|
||||
markedUnreadValue = markedUnread
|
||||
} else if let states = modifier.getPeerReadStates(peerId) {
|
||||
inner: for (stateNamespace, stateValue) in states {
|
||||
if stateNamespace == namespace {
|
||||
markedUnreadValue = stateValue.markedUnread
|
||||
break inner
|
||||
}
|
||||
}
|
||||
}
|
||||
modifier.resetIncomingReadStates([peerId: [namespace: .idBased(maxIncomingReadId: maxIncomingReadId, maxOutgoingReadId: maxOutgoingReadId, maxKnownId: maxKnownId, count: count, markedUnread: markedUnreadValue)]])
|
||||
case let .UpdatePeerChatUnreadMark(peerId, namespace, value):
|
||||
modifier.applyMarkUnread(peerId: peerId, namespace: namespace, value: value, interactive: false)
|
||||
case let .ResetMessageTagSummary(peerId, namespace, count, range):
|
||||
modifier.replaceMessageTagSummary(peerId: peerId, tagMask: .unseenPersonalMessage, namespace: namespace, count: count, maxId: range.maxId)
|
||||
case let .UpdateState(state):
|
||||
|
||||
@ -79,16 +79,18 @@ func accountStateReset(postbox: Postbox, network: Network) -> Signal<Void, NoErr
|
||||
let apiReadOutboxMaxId: Int32
|
||||
let apiTopMessage: Int32
|
||||
let apiUnreadCount: Int32
|
||||
let apiMarkedUnread: Bool
|
||||
let apiUnreadMentionsCount: Int32
|
||||
var apiChannelPts: Int32?
|
||||
let apiNotificationSettings: Api.PeerNotifySettings
|
||||
switch dialog {
|
||||
case let .dialog(_, peer, topMessage, readInboxMaxId, readOutboxMaxId, unreadCount, unreadMentionsCount, peerNotificationSettings, pts, _):
|
||||
case let .dialog(flags, peer, topMessage, readInboxMaxId, readOutboxMaxId, unreadCount, unreadMentionsCount, peerNotificationSettings, pts, _):
|
||||
apiPeer = peer
|
||||
apiTopMessage = topMessage
|
||||
apiReadInboxMaxId = readInboxMaxId
|
||||
apiReadOutboxMaxId = readOutboxMaxId
|
||||
apiUnreadCount = unreadCount
|
||||
apiMarkedUnread = (flags & (1 << 3)) != 0
|
||||
apiUnreadMentionsCount = unreadMentionsCount
|
||||
apiNotificationSettings = peerNotificationSettings
|
||||
apiChannelPts = pts
|
||||
@ -111,7 +113,7 @@ func accountStateReset(postbox: Postbox, network: Network) -> Signal<Void, NoErr
|
||||
if readStates[peerId] == nil {
|
||||
readStates[peerId] = [:]
|
||||
}
|
||||
readStates[peerId]![Namespaces.Message.Cloud] = .idBased(maxIncomingReadId: apiReadInboxMaxId, maxOutgoingReadId: apiReadOutboxMaxId, maxKnownId: apiTopMessage, count: apiUnreadCount)
|
||||
readStates[peerId]![Namespaces.Message.Cloud] = .idBased(maxIncomingReadId: apiReadInboxMaxId, maxOutgoingReadId: apiReadOutboxMaxId, maxKnownId: apiTopMessage, count: apiUnreadCount, markedUnread: apiMarkedUnread)
|
||||
|
||||
if apiTopMessage != 0 {
|
||||
mentionTagSummaries[peerId] = MessageHistoryTagNamespaceSummary(version: 1, count: apiUnreadMentionsCount, range: MessageHistoryTagNamespaceCountValidityRange(maxId: apiTopMessage))
|
||||
|
||||
@ -75,7 +75,7 @@ fileprivate let parsers: [Int32 : (BufferReader) -> Any?] = {
|
||||
dict[-292807034] = { return Api.InputChannel.parse_inputChannelEmpty($0) }
|
||||
dict[-1343524562] = { return Api.InputChannel.parse_inputChannel($0) }
|
||||
dict[414687501] = { return Api.DcOption.parse_dcOption($0) }
|
||||
dict[-1212732749] = { return Api.account.PasswordSettings.parse_passwordSettings($0) }
|
||||
dict[2077869041] = { return Api.account.PasswordSettings.parse_passwordSettings($0) }
|
||||
dict[292985073] = { return Api.LangPackLanguage.parse_langPackLanguage($0) }
|
||||
dict[-1987579119] = { return Api.help.AppUpdate.parse_appUpdate($0) }
|
||||
dict[-1000708810] = { return Api.help.AppUpdate.parse_noAppUpdate($0) }
|
||||
@ -195,6 +195,7 @@ fileprivate let parsers: [Int32 : (BufferReader) -> Any?] = {
|
||||
dict[1893427255] = { return Api.Update.parse_updateChannelAvailableMessages($0) }
|
||||
dict[433225532] = { return Api.Update.parse_updateDialogPinned($0) }
|
||||
dict[-364071333] = { return Api.Update.parse_updatePinnedDialogs($0) }
|
||||
dict[-513517117] = { return Api.Update.parse_updateDialogUnreadMark($0) }
|
||||
dict[1558266229] = { return Api.PopularContact.parse_popularContact($0) }
|
||||
dict[367766557] = { return Api.ChannelParticipant.parse_channelParticipant($0) }
|
||||
dict[-1557620115] = { return Api.ChannelParticipant.parse_channelParticipantSelf($0) }
|
||||
@ -214,6 +215,8 @@ fileprivate let parsers: [Int32 : (BufferReader) -> Any?] = {
|
||||
dict[1358175439] = { return Api.KeyboardButton.parse_keyboardButtonGame($0) }
|
||||
dict[-1344716869] = { return Api.KeyboardButton.parse_keyboardButtonBuy($0) }
|
||||
dict[-748155807] = { return Api.ContactStatus.parse_contactStatus($0) }
|
||||
dict[1679398724] = { return Api.SecureFile.parse_secureFileEmpty($0) }
|
||||
dict[-534283678] = { return Api.SecureFile.parse_secureFile($0) }
|
||||
dict[236446268] = { return Api.PhotoSize.parse_photoSizeEmpty($0) }
|
||||
dict[2009052699] = { return Api.PhotoSize.parse_photoSize($0) }
|
||||
dict[-374917894] = { return Api.PhotoSize.parse_photoCachedSize($0) }
|
||||
@ -265,6 +268,7 @@ fileprivate let parsers: [Int32 : (BufferReader) -> Any?] = {
|
||||
dict[1928391342] = { return Api.InputDocument.parse_inputDocumentEmpty($0) }
|
||||
dict[410618194] = { return Api.InputDocument.parse_inputDocument($0) }
|
||||
dict[2131196633] = { return Api.contacts.ResolvedPeer.parse_resolvedPeer($0) }
|
||||
dict[-1964327229] = { return Api.SecureData.parse_secureData($0) }
|
||||
dict[-1771768449] = { return Api.InputMedia.parse_inputMediaEmpty($0) }
|
||||
dict[-104578748] = { return Api.InputMedia.parse_inputMediaGeoPoint($0) }
|
||||
dict[-1494984313] = { return Api.InputMedia.parse_inputMediaContact($0) }
|
||||
@ -322,11 +326,16 @@ fileprivate let parsers: [Int32 : (BufferReader) -> Any?] = {
|
||||
dict[-526508104] = { return Api.help.ProxyData.parse_proxyDataEmpty($0) }
|
||||
dict[737668643] = { return Api.help.ProxyData.parse_proxyDataPromo($0) }
|
||||
dict[-543777747] = { return Api.auth.ExportedAuthorization.parse_exportedAuthorization($0) }
|
||||
dict[2103482845] = { return Api.SecurePlainData.parse_securePlainPhone($0) }
|
||||
dict[569137759] = { return Api.SecurePlainData.parse_securePlainEmail($0) }
|
||||
dict[-1269012015] = { return Api.messages.AffectedHistory.parse_affectedHistory($0) }
|
||||
dict[-2037289493] = { return Api.account.PasswordInputSettings.parse_passwordInputSettings($0) }
|
||||
dict[570402317] = { return Api.account.PasswordInputSettings.parse_passwordInputSettings($0) }
|
||||
dict[649453030] = { return Api.messages.MessageEditData.parse_messageEditData($0) }
|
||||
dict[-886477832] = { return Api.LabeledPrice.parse_labeledPrice($0) }
|
||||
dict[-438840932] = { return Api.messages.ChatFull.parse_chatFull($0) }
|
||||
dict[108557032] = { return Api.InputSecureValue.parse_inputSecureValue($0) }
|
||||
dict[1722786150] = { return Api.help.DeepLinkInfo.parse_deepLinkInfoEmpty($0) }
|
||||
dict[1783556146] = { return Api.help.DeepLinkInfo.parse_deepLinkInfo($0) }
|
||||
dict[-313079300] = { return Api.account.WebAuthorizations.parse_webAuthorizations($0) }
|
||||
dict[2013922064] = { return Api.help.TermsOfService.parse_termsOfService($0) }
|
||||
dict[1490799288] = { return Api.ReportReason.parse_inputReportReasonSpam($0) }
|
||||
@ -337,8 +346,15 @@ fileprivate let parsers: [Int32 : (BufferReader) -> Any?] = {
|
||||
dict[-1169445179] = { return Api.DraftMessage.parse_draftMessageEmpty($0) }
|
||||
dict[-40996577] = { return Api.DraftMessage.parse_draftMessage($0) }
|
||||
dict[1568467877] = { return Api.ChannelAdminRights.parse_channelAdminRights($0) }
|
||||
dict[-2128640689] = { return Api.account.SentEmailCode.parse_sentEmailCode($0) }
|
||||
dict[-1038136962] = { return Api.EncryptedFile.parse_encryptedFileEmpty($0) }
|
||||
dict[1248893260] = { return Api.EncryptedFile.parse_encryptedFile($0) }
|
||||
dict[-391902247] = { return Api.SecureValueError.parse_secureValueErrorData($0) }
|
||||
dict[12467706] = { return Api.SecureValueError.parse_secureValueErrorFrontSide($0) }
|
||||
dict[-2037765467] = { return Api.SecureValueError.parse_secureValueErrorReverseSide($0) }
|
||||
dict[-449327402] = { return Api.SecureValueError.parse_secureValueErrorSelfie($0) }
|
||||
dict[2054162547] = { return Api.SecureValueError.parse_secureValueErrorFile($0) }
|
||||
dict[1717706985] = { return Api.SecureValueError.parse_secureValueErrorFiles($0) }
|
||||
dict[1489977929] = { return Api.ChannelBannedRights.parse_channelBannedRights($0) }
|
||||
dict[-1613493288] = { return Api.NotifyPeer.parse_notifyPeer($0) }
|
||||
dict[-1261946036] = { return Api.NotifyPeer.parse_notifyUsers($0) }
|
||||
@ -354,6 +370,8 @@ fileprivate let parsers: [Int32 : (BufferReader) -> Any?] = {
|
||||
dict[1493171408] = { return Api.HighScore.parse_highScore($0) }
|
||||
dict[-305282981] = { return Api.TopPeer.parse_topPeer($0) }
|
||||
dict[986597452] = { return Api.contacts.Link.parse_link($0) }
|
||||
dict[-1263225191] = { return Api.SecureValue.parse_secureValue($0) }
|
||||
dict[-316748368] = { return Api.SecureValueHash.parse_secureValueHash($0) }
|
||||
dict[1444661369] = { return Api.ContactBlocked.parse_contactBlocked($0) }
|
||||
dict[-2128698738] = { return Api.auth.CheckedPhone.parse_checkedPhone($0) }
|
||||
dict[-1182234929] = { return Api.InputUser.parse_inputUserEmpty($0) }
|
||||
@ -361,6 +379,7 @@ fileprivate let parsers: [Int32 : (BufferReader) -> Any?] = {
|
||||
dict[-668391402] = { return Api.InputUser.parse_inputUser($0) }
|
||||
dict[-1908433218] = { return Api.Page.parse_pagePart($0) }
|
||||
dict[1433323434] = { return Api.Page.parse_pageFull($0) }
|
||||
dict[871426631] = { return Api.SecureCredentialsEncrypted.parse_secureCredentialsEncrypted($0) }
|
||||
dict[157948117] = { return Api.upload.File.parse_file($0) }
|
||||
dict[-242427324] = { return Api.upload.File.parse_fileCdnRedirect($0) }
|
||||
dict[182649427] = { return Api.MessageRange.parse_messageRange($0) }
|
||||
@ -446,6 +465,7 @@ fileprivate let parsers: [Int32 : (BufferReader) -> Any?] = {
|
||||
dict[342061462] = { return Api.InputFileLocation.parse_inputFileLocation($0) }
|
||||
dict[-182231723] = { return Api.InputFileLocation.parse_inputEncryptedFileLocation($0) }
|
||||
dict[1125058340] = { return Api.InputFileLocation.parse_inputDocumentFileLocation($0) }
|
||||
dict[-876089816] = { return Api.InputFileLocation.parse_inputSecureFileLocation($0) }
|
||||
dict[286776671] = { return Api.GeoPoint.parse_geoPointEmpty($0) }
|
||||
dict[541710092] = { return Api.GeoPoint.parse_geoPoint($0) }
|
||||
dict[506920429] = { return Api.InputPhoneCall.parse_inputPhoneCall($0) }
|
||||
@ -457,6 +477,8 @@ fileprivate let parsers: [Int32 : (BufferReader) -> Any?] = {
|
||||
dict[178373535] = { return Api.InputPaymentCredentials.parse_inputPaymentCredentialsApplePay($0) }
|
||||
dict[-905587442] = { return Api.InputPaymentCredentials.parse_inputPaymentCredentialsAndroidPay($0) }
|
||||
dict[-1239335713] = { return Api.ShippingOption.parse_shippingOption($0) }
|
||||
dict[859091184] = { return Api.InputSecureFile.parse_inputSecureFileUploaded($0) }
|
||||
dict[1399317950] = { return Api.InputSecureFile.parse_inputSecureFile($0) }
|
||||
dict[512535275] = { return Api.PostAddress.parse_postAddress($0) }
|
||||
dict[2104790276] = { return Api.DataJSON.parse_dataJSON($0) }
|
||||
dict[1251549527] = { return Api.InputStickeredMedia.parse_inputStickeredMediaPhoto($0) }
|
||||
@ -517,14 +539,28 @@ fileprivate let parsers: [Int32 : (BufferReader) -> Any?] = {
|
||||
dict[-209768682] = { return Api.messages.FavedStickers.parse_favedStickers($0) }
|
||||
dict[1776236393] = { return Api.ExportedChatInvite.parse_chatInviteEmpty($0) }
|
||||
dict[-64092740] = { return Api.ExportedChatInvite.parse_chatInviteExported($0) }
|
||||
dict[-879268525] = { return Api.account.AuthorizationForm.parse_authorizationForm($0) }
|
||||
dict[2079516406] = { return Api.Authorization.parse_authorization($0) }
|
||||
dict[-1361650766] = { return Api.MaskCoords.parse_maskCoords($0) }
|
||||
dict[-395967805] = { return Api.messages.AllStickers.parse_allStickersNotModified($0) }
|
||||
dict[-302170017] = { return Api.messages.AllStickers.parse_allStickers($0) }
|
||||
dict[-1655957568] = { return Api.PhoneConnection.parse_phoneConnection($0) }
|
||||
dict[-1194283041] = { return Api.AccountDaysTTL.parse_accountDaysTTL($0) }
|
||||
dict[-1764049896] = { return Api.account.Password.parse_noPassword($0) }
|
||||
dict[2081952796] = { return Api.account.Password.parse_password($0) }
|
||||
dict[-1658158621] = { return Api.SecureValueType.parse_secureValueTypePersonalDetails($0) }
|
||||
dict[1034709504] = { return Api.SecureValueType.parse_secureValueTypePassport($0) }
|
||||
dict[115615172] = { return Api.SecureValueType.parse_secureValueTypeDriverLicense($0) }
|
||||
dict[-1596951477] = { return Api.SecureValueType.parse_secureValueTypeIdentityCard($0) }
|
||||
dict[-1717268701] = { return Api.SecureValueType.parse_secureValueTypeInternalPassport($0) }
|
||||
dict[-874308058] = { return Api.SecureValueType.parse_secureValueTypeAddress($0) }
|
||||
dict[-63531698] = { return Api.SecureValueType.parse_secureValueTypeUtilityBill($0) }
|
||||
dict[-1995211763] = { return Api.SecureValueType.parse_secureValueTypeBankStatement($0) }
|
||||
dict[-1954007928] = { return Api.SecureValueType.parse_secureValueTypeRentalAgreement($0) }
|
||||
dict[-1713143702] = { return Api.SecureValueType.parse_secureValueTypePassportRegistration($0) }
|
||||
dict[-368907213] = { return Api.SecureValueType.parse_secureValueTypeTemporaryRegistration($0) }
|
||||
dict[-1289704741] = { return Api.SecureValueType.parse_secureValueTypePhone($0) }
|
||||
dict[-1908627474] = { return Api.SecureValueType.parse_secureValueTypeEmail($0) }
|
||||
dict[1587643126] = { return Api.account.Password.parse_noPassword($0) }
|
||||
dict[-902187961] = { return Api.account.Password.parse_password($0) }
|
||||
dict[-1462213465] = { return Api.InputBotInlineResult.parse_inputBotInlineResultPhoto($0) }
|
||||
dict[-459324] = { return Api.InputBotInlineResult.parse_inputBotInlineResultDocument($0) }
|
||||
dict[1336154098] = { return Api.InputBotInlineResult.parse_inputBotInlineResultGame($0) }
|
||||
@ -556,6 +592,8 @@ fileprivate let parsers: [Int32 : (BufferReader) -> Any?] = {
|
||||
dict[1200788123] = { return Api.MessageAction.parse_messageActionScreenshotTaken($0) }
|
||||
dict[-85549226] = { return Api.MessageAction.parse_messageActionCustomAction($0) }
|
||||
dict[-1410748418] = { return Api.MessageAction.parse_messageActionBotAllowed($0) }
|
||||
dict[455635795] = { return Api.MessageAction.parse_messageActionSecureValuesSentMe($0) }
|
||||
dict[-648257196] = { return Api.MessageAction.parse_messageActionSecureValuesSent($0) }
|
||||
dict[1399245077] = { return Api.PhoneCall.parse_phoneCallEmpty($0) }
|
||||
dict[462375633] = { return Api.PhoneCall.parse_phoneCallWaiting($0) }
|
||||
dict[-2089411356] = { return Api.PhoneCall.parse_phoneCallRequested($0) }
|
||||
@ -767,6 +805,8 @@ struct Api {
|
||||
_1.serialize(buffer, boxed)
|
||||
case let _1 as Api.ContactStatus:
|
||||
_1.serialize(buffer, boxed)
|
||||
case let _1 as Api.SecureFile:
|
||||
_1.serialize(buffer, boxed)
|
||||
case let _1 as Api.PhotoSize:
|
||||
_1.serialize(buffer, boxed)
|
||||
case let _1 as Api.messages.Stickers:
|
||||
@ -811,6 +851,8 @@ struct Api {
|
||||
_1.serialize(buffer, boxed)
|
||||
case let _1 as Api.contacts.ResolvedPeer:
|
||||
_1.serialize(buffer, boxed)
|
||||
case let _1 as Api.SecureData:
|
||||
_1.serialize(buffer, boxed)
|
||||
case let _1 as Api.InputMedia:
|
||||
_1.serialize(buffer, boxed)
|
||||
case let _1 as Api.InputPeer:
|
||||
@ -841,6 +883,8 @@ struct Api {
|
||||
_1.serialize(buffer, boxed)
|
||||
case let _1 as Api.auth.ExportedAuthorization:
|
||||
_1.serialize(buffer, boxed)
|
||||
case let _1 as Api.SecurePlainData:
|
||||
_1.serialize(buffer, boxed)
|
||||
case let _1 as Api.messages.AffectedHistory:
|
||||
_1.serialize(buffer, boxed)
|
||||
case let _1 as Api.account.PasswordInputSettings:
|
||||
@ -851,6 +895,10 @@ struct Api {
|
||||
_1.serialize(buffer, boxed)
|
||||
case let _1 as Api.messages.ChatFull:
|
||||
_1.serialize(buffer, boxed)
|
||||
case let _1 as Api.InputSecureValue:
|
||||
_1.serialize(buffer, boxed)
|
||||
case let _1 as Api.help.DeepLinkInfo:
|
||||
_1.serialize(buffer, boxed)
|
||||
case let _1 as Api.account.WebAuthorizations:
|
||||
_1.serialize(buffer, boxed)
|
||||
case let _1 as Api.help.TermsOfService:
|
||||
@ -863,8 +911,12 @@ struct Api {
|
||||
_1.serialize(buffer, boxed)
|
||||
case let _1 as Api.ChannelAdminRights:
|
||||
_1.serialize(buffer, boxed)
|
||||
case let _1 as Api.account.SentEmailCode:
|
||||
_1.serialize(buffer, boxed)
|
||||
case let _1 as Api.EncryptedFile:
|
||||
_1.serialize(buffer, boxed)
|
||||
case let _1 as Api.SecureValueError:
|
||||
_1.serialize(buffer, boxed)
|
||||
case let _1 as Api.ChannelBannedRights:
|
||||
_1.serialize(buffer, boxed)
|
||||
case let _1 as Api.NotifyPeer:
|
||||
@ -881,6 +933,10 @@ struct Api {
|
||||
_1.serialize(buffer, boxed)
|
||||
case let _1 as Api.contacts.Link:
|
||||
_1.serialize(buffer, boxed)
|
||||
case let _1 as Api.SecureValue:
|
||||
_1.serialize(buffer, boxed)
|
||||
case let _1 as Api.SecureValueHash:
|
||||
_1.serialize(buffer, boxed)
|
||||
case let _1 as Api.ContactBlocked:
|
||||
_1.serialize(buffer, boxed)
|
||||
case let _1 as Api.auth.CheckedPhone:
|
||||
@ -889,6 +945,8 @@ struct Api {
|
||||
_1.serialize(buffer, boxed)
|
||||
case let _1 as Api.Page:
|
||||
_1.serialize(buffer, boxed)
|
||||
case let _1 as Api.SecureCredentialsEncrypted:
|
||||
_1.serialize(buffer, boxed)
|
||||
case let _1 as Api.upload.File:
|
||||
_1.serialize(buffer, boxed)
|
||||
case let _1 as Api.MessageRange:
|
||||
@ -979,6 +1037,8 @@ struct Api {
|
||||
_1.serialize(buffer, boxed)
|
||||
case let _1 as Api.ShippingOption:
|
||||
_1.serialize(buffer, boxed)
|
||||
case let _1 as Api.InputSecureFile:
|
||||
_1.serialize(buffer, boxed)
|
||||
case let _1 as Api.PostAddress:
|
||||
_1.serialize(buffer, boxed)
|
||||
case let _1 as Api.DataJSON:
|
||||
@ -1027,6 +1087,8 @@ struct Api {
|
||||
_1.serialize(buffer, boxed)
|
||||
case let _1 as Api.ExportedChatInvite:
|
||||
_1.serialize(buffer, boxed)
|
||||
case let _1 as Api.account.AuthorizationForm:
|
||||
_1.serialize(buffer, boxed)
|
||||
case let _1 as Api.Authorization:
|
||||
_1.serialize(buffer, boxed)
|
||||
case let _1 as Api.MaskCoords:
|
||||
@ -1037,6 +1099,8 @@ struct Api {
|
||||
_1.serialize(buffer, boxed)
|
||||
case let _1 as Api.AccountDaysTTL:
|
||||
_1.serialize(buffer, boxed)
|
||||
case let _1 as Api.SecureValueType:
|
||||
_1.serialize(buffer, boxed)
|
||||
case let _1 as Api.account.Password:
|
||||
_1.serialize(buffer, boxed)
|
||||
case let _1 as Api.InputBotInlineResult:
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
@ -1469,6 +1469,66 @@ struct help {
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
enum DeepLinkInfo: TypeConstructorDescription {
|
||||
case deepLinkInfoEmpty
|
||||
case deepLinkInfo(flags: Int32, message: String, entities: [Api.MessageEntity]?)
|
||||
|
||||
func serialize(_ buffer: Buffer, _ boxed: Swift.Bool) {
|
||||
switch self {
|
||||
case .deepLinkInfoEmpty:
|
||||
if boxed {
|
||||
buffer.appendInt32(1722786150)
|
||||
}
|
||||
|
||||
break
|
||||
case .deepLinkInfo(let flags, let message, let entities):
|
||||
if boxed {
|
||||
buffer.appendInt32(1783556146)
|
||||
}
|
||||
serializeInt32(flags, buffer: buffer, boxed: false)
|
||||
serializeString(message, buffer: buffer, boxed: false)
|
||||
if Int(flags) & Int(1 << 1) != 0 {buffer.appendInt32(481674261)
|
||||
buffer.appendInt32(Int32(entities!.count))
|
||||
for item in entities! {
|
||||
item.serialize(buffer, true)
|
||||
}}
|
||||
break
|
||||
}
|
||||
}
|
||||
|
||||
func descriptionFields() -> (String, [(String, Any)]) {
|
||||
switch self {
|
||||
case .deepLinkInfoEmpty:
|
||||
return ("deepLinkInfoEmpty", [])
|
||||
case .deepLinkInfo(let flags, let message, let entities):
|
||||
return ("deepLinkInfo", [("flags", flags), ("message", message), ("entities", entities)])
|
||||
}
|
||||
}
|
||||
|
||||
static func parse_deepLinkInfoEmpty(_ reader: BufferReader) -> DeepLinkInfo? {
|
||||
return Api.help.DeepLinkInfo.deepLinkInfoEmpty
|
||||
}
|
||||
static func parse_deepLinkInfo(_ reader: BufferReader) -> DeepLinkInfo? {
|
||||
var _1: Int32?
|
||||
_1 = reader.readInt32()
|
||||
var _2: String?
|
||||
_2 = parseString(reader)
|
||||
var _3: [Api.MessageEntity]?
|
||||
if Int(_1!) & Int(1 << 1) != 0 {if let _ = reader.readInt32() {
|
||||
_3 = Api.parseVector(reader, elementSignature: 0, elementType: Api.MessageEntity.self)
|
||||
} }
|
||||
let _c1 = _1 != nil
|
||||
let _c2 = _2 != nil
|
||||
let _c3 = (Int(_1!) & Int(1 << 1) == 0) || _3 != nil
|
||||
if _c1 && _c2 && _c3 {
|
||||
return Api.help.DeepLinkInfo.deepLinkInfo(flags: _1!, message: _2!, entities: _3)
|
||||
}
|
||||
else {
|
||||
return nil
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
enum TermsOfService: TypeConstructorDescription {
|
||||
case termsOfService(flags: Int32, id: Api.DataJSON, text: String, entities: [Api.MessageEntity], minAgeConfirm: Int32?)
|
||||
@ -2168,199 +2228,3 @@ struct updates {
|
||||
}
|
||||
}
|
||||
}
|
||||
extension Api {
|
||||
struct upload {
|
||||
enum WebFile: TypeConstructorDescription {
|
||||
case webFile(size: Int32, mimeType: String, fileType: Api.storage.FileType, mtime: Int32, bytes: Buffer)
|
||||
|
||||
func serialize(_ buffer: Buffer, _ boxed: Swift.Bool) {
|
||||
switch self {
|
||||
case .webFile(let size, let mimeType, let fileType, let mtime, let bytes):
|
||||
if boxed {
|
||||
buffer.appendInt32(568808380)
|
||||
}
|
||||
serializeInt32(size, buffer: buffer, boxed: false)
|
||||
serializeString(mimeType, buffer: buffer, boxed: false)
|
||||
fileType.serialize(buffer, true)
|
||||
serializeInt32(mtime, buffer: buffer, boxed: false)
|
||||
serializeBytes(bytes, buffer: buffer, boxed: false)
|
||||
break
|
||||
}
|
||||
}
|
||||
|
||||
func descriptionFields() -> (String, [(String, Any)]) {
|
||||
switch self {
|
||||
case .webFile(let size, let mimeType, let fileType, let mtime, let bytes):
|
||||
return ("webFile", [("size", size), ("mimeType", mimeType), ("fileType", fileType), ("mtime", mtime), ("bytes", bytes)])
|
||||
}
|
||||
}
|
||||
|
||||
static func parse_webFile(_ reader: BufferReader) -> WebFile? {
|
||||
var _1: Int32?
|
||||
_1 = reader.readInt32()
|
||||
var _2: String?
|
||||
_2 = parseString(reader)
|
||||
var _3: Api.storage.FileType?
|
||||
if let signature = reader.readInt32() {
|
||||
_3 = Api.parse(reader, signature: signature) as? Api.storage.FileType
|
||||
}
|
||||
var _4: Int32?
|
||||
_4 = reader.readInt32()
|
||||
var _5: Buffer?
|
||||
_5 = parseBytes(reader)
|
||||
let _c1 = _1 != nil
|
||||
let _c2 = _2 != nil
|
||||
let _c3 = _3 != nil
|
||||
let _c4 = _4 != nil
|
||||
let _c5 = _5 != nil
|
||||
if _c1 && _c2 && _c3 && _c4 && _c5 {
|
||||
return Api.upload.WebFile.webFile(size: _1!, mimeType: _2!, fileType: _3!, mtime: _4!, bytes: _5!)
|
||||
}
|
||||
else {
|
||||
return nil
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
enum File: TypeConstructorDescription {
|
||||
case file(type: Api.storage.FileType, mtime: Int32, bytes: Buffer)
|
||||
case fileCdnRedirect(dcId: Int32, fileToken: Buffer, encryptionKey: Buffer, encryptionIv: Buffer, fileHashes: [Api.FileHash])
|
||||
|
||||
func serialize(_ buffer: Buffer, _ boxed: Swift.Bool) {
|
||||
switch self {
|
||||
case .file(let type, let mtime, let bytes):
|
||||
if boxed {
|
||||
buffer.appendInt32(157948117)
|
||||
}
|
||||
type.serialize(buffer, true)
|
||||
serializeInt32(mtime, buffer: buffer, boxed: false)
|
||||
serializeBytes(bytes, buffer: buffer, boxed: false)
|
||||
break
|
||||
case .fileCdnRedirect(let dcId, let fileToken, let encryptionKey, let encryptionIv, let fileHashes):
|
||||
if boxed {
|
||||
buffer.appendInt32(-242427324)
|
||||
}
|
||||
serializeInt32(dcId, buffer: buffer, boxed: false)
|
||||
serializeBytes(fileToken, buffer: buffer, boxed: false)
|
||||
serializeBytes(encryptionKey, buffer: buffer, boxed: false)
|
||||
serializeBytes(encryptionIv, buffer: buffer, boxed: false)
|
||||
buffer.appendInt32(481674261)
|
||||
buffer.appendInt32(Int32(fileHashes.count))
|
||||
for item in fileHashes {
|
||||
item.serialize(buffer, true)
|
||||
}
|
||||
break
|
||||
}
|
||||
}
|
||||
|
||||
func descriptionFields() -> (String, [(String, Any)]) {
|
||||
switch self {
|
||||
case .file(let type, let mtime, let bytes):
|
||||
return ("file", [("type", type), ("mtime", mtime), ("bytes", bytes)])
|
||||
case .fileCdnRedirect(let dcId, let fileToken, let encryptionKey, let encryptionIv, let fileHashes):
|
||||
return ("fileCdnRedirect", [("dcId", dcId), ("fileToken", fileToken), ("encryptionKey", encryptionKey), ("encryptionIv", encryptionIv), ("fileHashes", fileHashes)])
|
||||
}
|
||||
}
|
||||
|
||||
static func parse_file(_ reader: BufferReader) -> File? {
|
||||
var _1: Api.storage.FileType?
|
||||
if let signature = reader.readInt32() {
|
||||
_1 = Api.parse(reader, signature: signature) as? Api.storage.FileType
|
||||
}
|
||||
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.upload.File.file(type: _1!, mtime: _2!, bytes: _3!)
|
||||
}
|
||||
else {
|
||||
return nil
|
||||
}
|
||||
}
|
||||
static func parse_fileCdnRedirect(_ reader: BufferReader) -> File? {
|
||||
var _1: Int32?
|
||||
_1 = reader.readInt32()
|
||||
var _2: Buffer?
|
||||
_2 = parseBytes(reader)
|
||||
var _3: Buffer?
|
||||
_3 = parseBytes(reader)
|
||||
var _4: Buffer?
|
||||
_4 = parseBytes(reader)
|
||||
var _5: [Api.FileHash]?
|
||||
if let _ = reader.readInt32() {
|
||||
_5 = Api.parseVector(reader, elementSignature: 0, elementType: Api.FileHash.self)
|
||||
}
|
||||
let _c1 = _1 != nil
|
||||
let _c2 = _2 != nil
|
||||
let _c3 = _3 != nil
|
||||
let _c4 = _4 != nil
|
||||
let _c5 = _5 != nil
|
||||
if _c1 && _c2 && _c3 && _c4 && _c5 {
|
||||
return Api.upload.File.fileCdnRedirect(dcId: _1!, fileToken: _2!, encryptionKey: _3!, encryptionIv: _4!, fileHashes: _5!)
|
||||
}
|
||||
else {
|
||||
return nil
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
enum CdnFile: TypeConstructorDescription {
|
||||
case cdnFileReuploadNeeded(requestToken: Buffer)
|
||||
case cdnFile(bytes: Buffer)
|
||||
|
||||
func serialize(_ buffer: Buffer, _ boxed: Swift.Bool) {
|
||||
switch self {
|
||||
case .cdnFileReuploadNeeded(let requestToken):
|
||||
if boxed {
|
||||
buffer.appendInt32(-290921362)
|
||||
}
|
||||
serializeBytes(requestToken, buffer: buffer, boxed: false)
|
||||
break
|
||||
case .cdnFile(let bytes):
|
||||
if boxed {
|
||||
buffer.appendInt32(-1449145777)
|
||||
}
|
||||
serializeBytes(bytes, buffer: buffer, boxed: false)
|
||||
break
|
||||
}
|
||||
}
|
||||
|
||||
func descriptionFields() -> (String, [(String, Any)]) {
|
||||
switch self {
|
||||
case .cdnFileReuploadNeeded(let requestToken):
|
||||
return ("cdnFileReuploadNeeded", [("requestToken", requestToken)])
|
||||
case .cdnFile(let bytes):
|
||||
return ("cdnFile", [("bytes", bytes)])
|
||||
}
|
||||
}
|
||||
|
||||
static func parse_cdnFileReuploadNeeded(_ reader: BufferReader) -> CdnFile? {
|
||||
var _1: Buffer?
|
||||
_1 = parseBytes(reader)
|
||||
let _c1 = _1 != nil
|
||||
if _c1 {
|
||||
return Api.upload.CdnFile.cdnFileReuploadNeeded(requestToken: _1!)
|
||||
}
|
||||
else {
|
||||
return nil
|
||||
}
|
||||
}
|
||||
static func parse_cdnFile(_ reader: BufferReader) -> CdnFile? {
|
||||
var _1: Buffer?
|
||||
_1 = parseBytes(reader)
|
||||
let _c1 = _1 != nil
|
||||
if _c1 {
|
||||
return Api.upload.CdnFile.cdnFile(bytes: _1!)
|
||||
}
|
||||
else {
|
||||
return nil
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@ -1,4 +1,200 @@
|
||||
extension Api {
|
||||
struct upload {
|
||||
enum WebFile: TypeConstructorDescription {
|
||||
case webFile(size: Int32, mimeType: String, fileType: Api.storage.FileType, mtime: Int32, bytes: Buffer)
|
||||
|
||||
func serialize(_ buffer: Buffer, _ boxed: Swift.Bool) {
|
||||
switch self {
|
||||
case .webFile(let size, let mimeType, let fileType, let mtime, let bytes):
|
||||
if boxed {
|
||||
buffer.appendInt32(568808380)
|
||||
}
|
||||
serializeInt32(size, buffer: buffer, boxed: false)
|
||||
serializeString(mimeType, buffer: buffer, boxed: false)
|
||||
fileType.serialize(buffer, true)
|
||||
serializeInt32(mtime, buffer: buffer, boxed: false)
|
||||
serializeBytes(bytes, buffer: buffer, boxed: false)
|
||||
break
|
||||
}
|
||||
}
|
||||
|
||||
func descriptionFields() -> (String, [(String, Any)]) {
|
||||
switch self {
|
||||
case .webFile(let size, let mimeType, let fileType, let mtime, let bytes):
|
||||
return ("webFile", [("size", size), ("mimeType", mimeType), ("fileType", fileType), ("mtime", mtime), ("bytes", bytes)])
|
||||
}
|
||||
}
|
||||
|
||||
static func parse_webFile(_ reader: BufferReader) -> WebFile? {
|
||||
var _1: Int32?
|
||||
_1 = reader.readInt32()
|
||||
var _2: String?
|
||||
_2 = parseString(reader)
|
||||
var _3: Api.storage.FileType?
|
||||
if let signature = reader.readInt32() {
|
||||
_3 = Api.parse(reader, signature: signature) as? Api.storage.FileType
|
||||
}
|
||||
var _4: Int32?
|
||||
_4 = reader.readInt32()
|
||||
var _5: Buffer?
|
||||
_5 = parseBytes(reader)
|
||||
let _c1 = _1 != nil
|
||||
let _c2 = _2 != nil
|
||||
let _c3 = _3 != nil
|
||||
let _c4 = _4 != nil
|
||||
let _c5 = _5 != nil
|
||||
if _c1 && _c2 && _c3 && _c4 && _c5 {
|
||||
return Api.upload.WebFile.webFile(size: _1!, mimeType: _2!, fileType: _3!, mtime: _4!, bytes: _5!)
|
||||
}
|
||||
else {
|
||||
return nil
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
enum File: TypeConstructorDescription {
|
||||
case file(type: Api.storage.FileType, mtime: Int32, bytes: Buffer)
|
||||
case fileCdnRedirect(dcId: Int32, fileToken: Buffer, encryptionKey: Buffer, encryptionIv: Buffer, fileHashes: [Api.FileHash])
|
||||
|
||||
func serialize(_ buffer: Buffer, _ boxed: Swift.Bool) {
|
||||
switch self {
|
||||
case .file(let type, let mtime, let bytes):
|
||||
if boxed {
|
||||
buffer.appendInt32(157948117)
|
||||
}
|
||||
type.serialize(buffer, true)
|
||||
serializeInt32(mtime, buffer: buffer, boxed: false)
|
||||
serializeBytes(bytes, buffer: buffer, boxed: false)
|
||||
break
|
||||
case .fileCdnRedirect(let dcId, let fileToken, let encryptionKey, let encryptionIv, let fileHashes):
|
||||
if boxed {
|
||||
buffer.appendInt32(-242427324)
|
||||
}
|
||||
serializeInt32(dcId, buffer: buffer, boxed: false)
|
||||
serializeBytes(fileToken, buffer: buffer, boxed: false)
|
||||
serializeBytes(encryptionKey, buffer: buffer, boxed: false)
|
||||
serializeBytes(encryptionIv, buffer: buffer, boxed: false)
|
||||
buffer.appendInt32(481674261)
|
||||
buffer.appendInt32(Int32(fileHashes.count))
|
||||
for item in fileHashes {
|
||||
item.serialize(buffer, true)
|
||||
}
|
||||
break
|
||||
}
|
||||
}
|
||||
|
||||
func descriptionFields() -> (String, [(String, Any)]) {
|
||||
switch self {
|
||||
case .file(let type, let mtime, let bytes):
|
||||
return ("file", [("type", type), ("mtime", mtime), ("bytes", bytes)])
|
||||
case .fileCdnRedirect(let dcId, let fileToken, let encryptionKey, let encryptionIv, let fileHashes):
|
||||
return ("fileCdnRedirect", [("dcId", dcId), ("fileToken", fileToken), ("encryptionKey", encryptionKey), ("encryptionIv", encryptionIv), ("fileHashes", fileHashes)])
|
||||
}
|
||||
}
|
||||
|
||||
static func parse_file(_ reader: BufferReader) -> File? {
|
||||
var _1: Api.storage.FileType?
|
||||
if let signature = reader.readInt32() {
|
||||
_1 = Api.parse(reader, signature: signature) as? Api.storage.FileType
|
||||
}
|
||||
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.upload.File.file(type: _1!, mtime: _2!, bytes: _3!)
|
||||
}
|
||||
else {
|
||||
return nil
|
||||
}
|
||||
}
|
||||
static func parse_fileCdnRedirect(_ reader: BufferReader) -> File? {
|
||||
var _1: Int32?
|
||||
_1 = reader.readInt32()
|
||||
var _2: Buffer?
|
||||
_2 = parseBytes(reader)
|
||||
var _3: Buffer?
|
||||
_3 = parseBytes(reader)
|
||||
var _4: Buffer?
|
||||
_4 = parseBytes(reader)
|
||||
var _5: [Api.FileHash]?
|
||||
if let _ = reader.readInt32() {
|
||||
_5 = Api.parseVector(reader, elementSignature: 0, elementType: Api.FileHash.self)
|
||||
}
|
||||
let _c1 = _1 != nil
|
||||
let _c2 = _2 != nil
|
||||
let _c3 = _3 != nil
|
||||
let _c4 = _4 != nil
|
||||
let _c5 = _5 != nil
|
||||
if _c1 && _c2 && _c3 && _c4 && _c5 {
|
||||
return Api.upload.File.fileCdnRedirect(dcId: _1!, fileToken: _2!, encryptionKey: _3!, encryptionIv: _4!, fileHashes: _5!)
|
||||
}
|
||||
else {
|
||||
return nil
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
enum CdnFile: TypeConstructorDescription {
|
||||
case cdnFileReuploadNeeded(requestToken: Buffer)
|
||||
case cdnFile(bytes: Buffer)
|
||||
|
||||
func serialize(_ buffer: Buffer, _ boxed: Swift.Bool) {
|
||||
switch self {
|
||||
case .cdnFileReuploadNeeded(let requestToken):
|
||||
if boxed {
|
||||
buffer.appendInt32(-290921362)
|
||||
}
|
||||
serializeBytes(requestToken, buffer: buffer, boxed: false)
|
||||
break
|
||||
case .cdnFile(let bytes):
|
||||
if boxed {
|
||||
buffer.appendInt32(-1449145777)
|
||||
}
|
||||
serializeBytes(bytes, buffer: buffer, boxed: false)
|
||||
break
|
||||
}
|
||||
}
|
||||
|
||||
func descriptionFields() -> (String, [(String, Any)]) {
|
||||
switch self {
|
||||
case .cdnFileReuploadNeeded(let requestToken):
|
||||
return ("cdnFileReuploadNeeded", [("requestToken", requestToken)])
|
||||
case .cdnFile(let bytes):
|
||||
return ("cdnFile", [("bytes", bytes)])
|
||||
}
|
||||
}
|
||||
|
||||
static func parse_cdnFileReuploadNeeded(_ reader: BufferReader) -> CdnFile? {
|
||||
var _1: Buffer?
|
||||
_1 = parseBytes(reader)
|
||||
let _c1 = _1 != nil
|
||||
if _c1 {
|
||||
return Api.upload.CdnFile.cdnFileReuploadNeeded(requestToken: _1!)
|
||||
}
|
||||
else {
|
||||
return nil
|
||||
}
|
||||
}
|
||||
static func parse_cdnFile(_ reader: BufferReader) -> CdnFile? {
|
||||
var _1: Buffer?
|
||||
_1 = parseBytes(reader)
|
||||
let _c1 = _1 != nil
|
||||
if _c1 {
|
||||
return Api.upload.CdnFile.cdnFile(bytes: _1!)
|
||||
}
|
||||
else {
|
||||
return nil
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
extension Api {
|
||||
struct storage {
|
||||
enum FileType: TypeConstructorDescription {
|
||||
case fileUnknown
|
||||
@ -177,32 +373,44 @@ struct account {
|
||||
|
||||
}
|
||||
enum PasswordSettings: TypeConstructorDescription {
|
||||
case passwordSettings(email: String)
|
||||
case passwordSettings(email: String, secureSalt: Buffer, secureSecret: Buffer, secureSecretId: Int64)
|
||||
|
||||
func serialize(_ buffer: Buffer, _ boxed: Swift.Bool) {
|
||||
switch self {
|
||||
case .passwordSettings(let email):
|
||||
case .passwordSettings(let email, let secureSalt, let secureSecret, let secureSecretId):
|
||||
if boxed {
|
||||
buffer.appendInt32(-1212732749)
|
||||
buffer.appendInt32(2077869041)
|
||||
}
|
||||
serializeString(email, buffer: buffer, boxed: false)
|
||||
serializeBytes(secureSalt, buffer: buffer, boxed: false)
|
||||
serializeBytes(secureSecret, buffer: buffer, boxed: false)
|
||||
serializeInt64(secureSecretId, buffer: buffer, boxed: false)
|
||||
break
|
||||
}
|
||||
}
|
||||
|
||||
func descriptionFields() -> (String, [(String, Any)]) {
|
||||
switch self {
|
||||
case .passwordSettings(let email):
|
||||
return ("passwordSettings", [("email", email)])
|
||||
case .passwordSettings(let email, let secureSalt, let secureSecret, let secureSecretId):
|
||||
return ("passwordSettings", [("email", email), ("secureSalt", secureSalt), ("secureSecret", secureSecret), ("secureSecretId", secureSecretId)])
|
||||
}
|
||||
}
|
||||
|
||||
static func parse_passwordSettings(_ reader: BufferReader) -> PasswordSettings? {
|
||||
var _1: String?
|
||||
_1 = parseString(reader)
|
||||
var _2: Buffer?
|
||||
_2 = parseBytes(reader)
|
||||
var _3: Buffer?
|
||||
_3 = parseBytes(reader)
|
||||
var _4: Int64?
|
||||
_4 = reader.readInt64()
|
||||
let _c1 = _1 != nil
|
||||
if _c1 {
|
||||
return Api.account.PasswordSettings.passwordSettings(email: _1!)
|
||||
let _c2 = _2 != nil
|
||||
let _c3 = _3 != nil
|
||||
let _c4 = _4 != nil
|
||||
if _c1 && _c2 && _c3 && _c4 {
|
||||
return Api.account.PasswordSettings.passwordSettings(email: _1!, secureSalt: _2!, secureSecret: _3!, secureSecretId: _4!)
|
||||
}
|
||||
else {
|
||||
return nil
|
||||
@ -211,27 +419,30 @@ struct account {
|
||||
|
||||
}
|
||||
enum PasswordInputSettings: TypeConstructorDescription {
|
||||
case passwordInputSettings(flags: Int32, newSalt: Buffer?, newPasswordHash: Buffer?, hint: String?, email: String?)
|
||||
case passwordInputSettings(flags: Int32, newSalt: Buffer?, newPasswordHash: Buffer?, hint: String?, email: String?, newSecureSalt: Buffer?, newSecureSecret: Buffer?, newSecureSecretId: Int64?)
|
||||
|
||||
func serialize(_ buffer: Buffer, _ boxed: Swift.Bool) {
|
||||
switch self {
|
||||
case .passwordInputSettings(let flags, let newSalt, let newPasswordHash, let hint, let email):
|
||||
case .passwordInputSettings(let flags, let newSalt, let newPasswordHash, let hint, let email, let newSecureSalt, let newSecureSecret, let newSecureSecretId):
|
||||
if boxed {
|
||||
buffer.appendInt32(-2037289493)
|
||||
buffer.appendInt32(570402317)
|
||||
}
|
||||
serializeInt32(flags, buffer: buffer, boxed: false)
|
||||
if Int(flags) & Int(1 << 0) != 0 {serializeBytes(newSalt!, buffer: buffer, boxed: false)}
|
||||
if Int(flags) & Int(1 << 0) != 0 {serializeBytes(newPasswordHash!, buffer: buffer, boxed: false)}
|
||||
if Int(flags) & Int(1 << 0) != 0 {serializeString(hint!, buffer: buffer, boxed: false)}
|
||||
if Int(flags) & Int(1 << 1) != 0 {serializeString(email!, buffer: buffer, boxed: false)}
|
||||
if Int(flags) & Int(1 << 2) != 0 {serializeBytes(newSecureSalt!, buffer: buffer, boxed: false)}
|
||||
if Int(flags) & Int(1 << 2) != 0 {serializeBytes(newSecureSecret!, buffer: buffer, boxed: false)}
|
||||
if Int(flags) & Int(1 << 2) != 0 {serializeInt64(newSecureSecretId!, buffer: buffer, boxed: false)}
|
||||
break
|
||||
}
|
||||
}
|
||||
|
||||
func descriptionFields() -> (String, [(String, Any)]) {
|
||||
switch self {
|
||||
case .passwordInputSettings(let flags, let newSalt, let newPasswordHash, let hint, let email):
|
||||
return ("passwordInputSettings", [("flags", flags), ("newSalt", newSalt), ("newPasswordHash", newPasswordHash), ("hint", hint), ("email", email)])
|
||||
case .passwordInputSettings(let flags, let newSalt, let newPasswordHash, let hint, let email, let newSecureSalt, let newSecureSecret, let newSecureSecretId):
|
||||
return ("passwordInputSettings", [("flags", flags), ("newSalt", newSalt), ("newPasswordHash", newPasswordHash), ("hint", hint), ("email", email), ("newSecureSalt", newSecureSalt), ("newSecureSecret", newSecureSecret), ("newSecureSecretId", newSecureSecretId)])
|
||||
}
|
||||
}
|
||||
|
||||
@ -246,13 +457,22 @@ struct account {
|
||||
if Int(_1!) & Int(1 << 0) != 0 {_4 = parseString(reader) }
|
||||
var _5: String?
|
||||
if Int(_1!) & Int(1 << 1) != 0 {_5 = parseString(reader) }
|
||||
var _6: Buffer?
|
||||
if Int(_1!) & Int(1 << 2) != 0 {_6 = parseBytes(reader) }
|
||||
var _7: Buffer?
|
||||
if Int(_1!) & Int(1 << 2) != 0 {_7 = parseBytes(reader) }
|
||||
var _8: Int64?
|
||||
if Int(_1!) & Int(1 << 2) != 0 {_8 = reader.readInt64() }
|
||||
let _c1 = _1 != nil
|
||||
let _c2 = (Int(_1!) & Int(1 << 0) == 0) || _2 != nil
|
||||
let _c3 = (Int(_1!) & Int(1 << 0) == 0) || _3 != nil
|
||||
let _c4 = (Int(_1!) & Int(1 << 0) == 0) || _4 != nil
|
||||
let _c5 = (Int(_1!) & Int(1 << 1) == 0) || _5 != nil
|
||||
if _c1 && _c2 && _c3 && _c4 && _c5 {
|
||||
return Api.account.PasswordInputSettings.passwordInputSettings(flags: _1!, newSalt: _2, newPasswordHash: _3, hint: _4, email: _5)
|
||||
let _c6 = (Int(_1!) & Int(1 << 2) == 0) || _6 != nil
|
||||
let _c7 = (Int(_1!) & Int(1 << 2) == 0) || _7 != nil
|
||||
let _c8 = (Int(_1!) & Int(1 << 2) == 0) || _8 != nil
|
||||
if _c1 && _c2 && _c3 && _c4 && _c5 && _c6 && _c7 && _c8 {
|
||||
return Api.account.PasswordInputSettings.passwordInputSettings(flags: _1!, newSalt: _2, newPasswordHash: _3, hint: _4, email: _5, newSecureSalt: _6, newSecureSecret: _7, newSecureSecretId: _8)
|
||||
}
|
||||
else {
|
||||
return nil
|
||||
@ -309,6 +529,44 @@ struct account {
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
enum SentEmailCode: TypeConstructorDescription {
|
||||
case sentEmailCode(emailPattern: String, length: Int32)
|
||||
|
||||
func serialize(_ buffer: Buffer, _ boxed: Swift.Bool) {
|
||||
switch self {
|
||||
case .sentEmailCode(let emailPattern, let length):
|
||||
if boxed {
|
||||
buffer.appendInt32(-2128640689)
|
||||
}
|
||||
serializeString(emailPattern, buffer: buffer, boxed: false)
|
||||
serializeInt32(length, buffer: buffer, boxed: false)
|
||||
break
|
||||
}
|
||||
}
|
||||
|
||||
func descriptionFields() -> (String, [(String, Any)]) {
|
||||
switch self {
|
||||
case .sentEmailCode(let emailPattern, let length):
|
||||
return ("sentEmailCode", [("emailPattern", emailPattern), ("length", length)])
|
||||
}
|
||||
}
|
||||
|
||||
static func parse_sentEmailCode(_ reader: BufferReader) -> SentEmailCode? {
|
||||
var _1: String?
|
||||
_1 = parseString(reader)
|
||||
var _2: Int32?
|
||||
_2 = reader.readInt32()
|
||||
let _c1 = _1 != nil
|
||||
let _c2 = _2 != nil
|
||||
if _c1 && _c2 {
|
||||
return Api.account.SentEmailCode.sentEmailCode(emailPattern: _1!, length: _2!)
|
||||
}
|
||||
else {
|
||||
return nil
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
enum Authorizations: TypeConstructorDescription {
|
||||
case authorizations(authorizations: [Api.Authorization])
|
||||
@ -350,27 +608,109 @@ struct account {
|
||||
}
|
||||
|
||||
}
|
||||
enum Password: TypeConstructorDescription {
|
||||
case noPassword(newSalt: Buffer, emailUnconfirmedPattern: String)
|
||||
case password(currentSalt: Buffer, newSalt: Buffer, hint: String, hasRecovery: Api.Bool, emailUnconfirmedPattern: String)
|
||||
enum AuthorizationForm: TypeConstructorDescription {
|
||||
case authorizationForm(flags: Int32, requiredTypes: [Api.SecureValueType], values: [Api.SecureValue], errors: [Api.SecureValueError], users: [Api.User], privacyPolicyUrl: String?)
|
||||
|
||||
func serialize(_ buffer: Buffer, _ boxed: Swift.Bool) {
|
||||
switch self {
|
||||
case .noPassword(let newSalt, let emailUnconfirmedPattern):
|
||||
case .authorizationForm(let flags, let requiredTypes, let values, let errors, let users, let privacyPolicyUrl):
|
||||
if boxed {
|
||||
buffer.appendInt32(-1764049896)
|
||||
buffer.appendInt32(-879268525)
|
||||
}
|
||||
serializeInt32(flags, buffer: buffer, boxed: false)
|
||||
buffer.appendInt32(481674261)
|
||||
buffer.appendInt32(Int32(requiredTypes.count))
|
||||
for item in requiredTypes {
|
||||
item.serialize(buffer, true)
|
||||
}
|
||||
buffer.appendInt32(481674261)
|
||||
buffer.appendInt32(Int32(values.count))
|
||||
for item in values {
|
||||
item.serialize(buffer, true)
|
||||
}
|
||||
buffer.appendInt32(481674261)
|
||||
buffer.appendInt32(Int32(errors.count))
|
||||
for item in errors {
|
||||
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(privacyPolicyUrl!, buffer: buffer, boxed: false)}
|
||||
break
|
||||
}
|
||||
}
|
||||
|
||||
func descriptionFields() -> (String, [(String, Any)]) {
|
||||
switch self {
|
||||
case .authorizationForm(let flags, let requiredTypes, let values, let errors, let users, let privacyPolicyUrl):
|
||||
return ("authorizationForm", [("flags", flags), ("requiredTypes", requiredTypes), ("values", values), ("errors", errors), ("users", users), ("privacyPolicyUrl", privacyPolicyUrl)])
|
||||
}
|
||||
}
|
||||
|
||||
static func parse_authorizationForm(_ reader: BufferReader) -> AuthorizationForm? {
|
||||
var _1: Int32?
|
||||
_1 = reader.readInt32()
|
||||
var _2: [Api.SecureValueType]?
|
||||
if let _ = reader.readInt32() {
|
||||
_2 = Api.parseVector(reader, elementSignature: 0, elementType: Api.SecureValueType.self)
|
||||
}
|
||||
var _3: [Api.SecureValue]?
|
||||
if let _ = reader.readInt32() {
|
||||
_3 = Api.parseVector(reader, elementSignature: 0, elementType: Api.SecureValue.self)
|
||||
}
|
||||
var _4: [Api.SecureValueError]?
|
||||
if let _ = reader.readInt32() {
|
||||
_4 = Api.parseVector(reader, elementSignature: 0, elementType: Api.SecureValueError.self)
|
||||
}
|
||||
var _5: [Api.User]?
|
||||
if let _ = reader.readInt32() {
|
||||
_5 = Api.parseVector(reader, elementSignature: 0, elementType: Api.User.self)
|
||||
}
|
||||
var _6: String?
|
||||
if Int(_1!) & Int(1 << 0) != 0 {_6 = parseString(reader) }
|
||||
let _c1 = _1 != nil
|
||||
let _c2 = _2 != nil
|
||||
let _c3 = _3 != nil
|
||||
let _c4 = _4 != nil
|
||||
let _c5 = _5 != nil
|
||||
let _c6 = (Int(_1!) & Int(1 << 0) == 0) || _6 != nil
|
||||
if _c1 && _c2 && _c3 && _c4 && _c5 && _c6 {
|
||||
return Api.account.AuthorizationForm.authorizationForm(flags: _1!, requiredTypes: _2!, values: _3!, errors: _4!, users: _5!, privacyPolicyUrl: _6)
|
||||
}
|
||||
else {
|
||||
return nil
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
enum Password: TypeConstructorDescription {
|
||||
case noPassword(newSalt: Buffer, newSecureSalt: Buffer, secureRandom: Buffer, emailUnconfirmedPattern: String)
|
||||
case password(flags: Int32, currentSalt: Buffer, newSalt: Buffer, newSecureSalt: Buffer, secureRandom: Buffer, hint: String, emailUnconfirmedPattern: String)
|
||||
|
||||
func serialize(_ buffer: Buffer, _ boxed: Swift.Bool) {
|
||||
switch self {
|
||||
case .noPassword(let newSalt, let newSecureSalt, let secureRandom, let emailUnconfirmedPattern):
|
||||
if boxed {
|
||||
buffer.appendInt32(1587643126)
|
||||
}
|
||||
serializeBytes(newSalt, buffer: buffer, boxed: false)
|
||||
serializeBytes(newSecureSalt, buffer: buffer, boxed: false)
|
||||
serializeBytes(secureRandom, buffer: buffer, boxed: false)
|
||||
serializeString(emailUnconfirmedPattern, buffer: buffer, boxed: false)
|
||||
break
|
||||
case .password(let currentSalt, let newSalt, let hint, let hasRecovery, let emailUnconfirmedPattern):
|
||||
case .password(let flags, let currentSalt, let newSalt, let newSecureSalt, let secureRandom, let hint, let emailUnconfirmedPattern):
|
||||
if boxed {
|
||||
buffer.appendInt32(2081952796)
|
||||
buffer.appendInt32(-902187961)
|
||||
}
|
||||
serializeInt32(flags, buffer: buffer, boxed: false)
|
||||
serializeBytes(currentSalt, buffer: buffer, boxed: false)
|
||||
serializeBytes(newSalt, buffer: buffer, boxed: false)
|
||||
serializeBytes(newSecureSalt, buffer: buffer, boxed: false)
|
||||
serializeBytes(secureRandom, buffer: buffer, boxed: false)
|
||||
serializeString(hint, buffer: buffer, boxed: false)
|
||||
hasRecovery.serialize(buffer, true)
|
||||
serializeString(emailUnconfirmedPattern, buffer: buffer, boxed: false)
|
||||
break
|
||||
}
|
||||
@ -378,47 +718,57 @@ struct account {
|
||||
|
||||
func descriptionFields() -> (String, [(String, Any)]) {
|
||||
switch self {
|
||||
case .noPassword(let newSalt, let emailUnconfirmedPattern):
|
||||
return ("noPassword", [("newSalt", newSalt), ("emailUnconfirmedPattern", emailUnconfirmedPattern)])
|
||||
case .password(let currentSalt, let newSalt, let hint, let hasRecovery, let emailUnconfirmedPattern):
|
||||
return ("password", [("currentSalt", currentSalt), ("newSalt", newSalt), ("hint", hint), ("hasRecovery", hasRecovery), ("emailUnconfirmedPattern", emailUnconfirmedPattern)])
|
||||
case .noPassword(let newSalt, let newSecureSalt, let secureRandom, let emailUnconfirmedPattern):
|
||||
return ("noPassword", [("newSalt", newSalt), ("newSecureSalt", newSecureSalt), ("secureRandom", secureRandom), ("emailUnconfirmedPattern", emailUnconfirmedPattern)])
|
||||
case .password(let flags, let currentSalt, let newSalt, let newSecureSalt, let secureRandom, let hint, let emailUnconfirmedPattern):
|
||||
return ("password", [("flags", flags), ("currentSalt", currentSalt), ("newSalt", newSalt), ("newSecureSalt", newSecureSalt), ("secureRandom", secureRandom), ("hint", hint), ("emailUnconfirmedPattern", emailUnconfirmedPattern)])
|
||||
}
|
||||
}
|
||||
|
||||
static func parse_noPassword(_ reader: BufferReader) -> Password? {
|
||||
var _1: Buffer?
|
||||
_1 = parseBytes(reader)
|
||||
var _2: String?
|
||||
_2 = parseString(reader)
|
||||
var _2: Buffer?
|
||||
_2 = parseBytes(reader)
|
||||
var _3: Buffer?
|
||||
_3 = parseBytes(reader)
|
||||
var _4: String?
|
||||
_4 = parseString(reader)
|
||||
let _c1 = _1 != nil
|
||||
let _c2 = _2 != nil
|
||||
if _c1 && _c2 {
|
||||
return Api.account.Password.noPassword(newSalt: _1!, emailUnconfirmedPattern: _2!)
|
||||
let _c3 = _3 != nil
|
||||
let _c4 = _4 != nil
|
||||
if _c1 && _c2 && _c3 && _c4 {
|
||||
return Api.account.Password.noPassword(newSalt: _1!, newSecureSalt: _2!, secureRandom: _3!, emailUnconfirmedPattern: _4!)
|
||||
}
|
||||
else {
|
||||
return nil
|
||||
}
|
||||
}
|
||||
static func parse_password(_ reader: BufferReader) -> Password? {
|
||||
var _1: Buffer?
|
||||
_1 = parseBytes(reader)
|
||||
var _1: Int32?
|
||||
_1 = reader.readInt32()
|
||||
var _2: Buffer?
|
||||
_2 = parseBytes(reader)
|
||||
var _3: String?
|
||||
_3 = parseString(reader)
|
||||
var _4: Api.Bool?
|
||||
if let signature = reader.readInt32() {
|
||||
_4 = Api.parse(reader, signature: signature) as? Api.Bool
|
||||
}
|
||||
var _5: String?
|
||||
_5 = parseString(reader)
|
||||
var _3: Buffer?
|
||||
_3 = parseBytes(reader)
|
||||
var _4: Buffer?
|
||||
_4 = parseBytes(reader)
|
||||
var _5: Buffer?
|
||||
_5 = parseBytes(reader)
|
||||
var _6: String?
|
||||
_6 = parseString(reader)
|
||||
var _7: String?
|
||||
_7 = parseString(reader)
|
||||
let _c1 = _1 != nil
|
||||
let _c2 = _2 != nil
|
||||
let _c3 = _3 != nil
|
||||
let _c4 = _4 != nil
|
||||
let _c5 = _5 != nil
|
||||
if _c1 && _c2 && _c3 && _c4 && _c5 {
|
||||
return Api.account.Password.password(currentSalt: _1!, newSalt: _2!, hint: _3!, hasRecovery: _4!, emailUnconfirmedPattern: _5!)
|
||||
let _c6 = _6 != nil
|
||||
let _c7 = _7 != nil
|
||||
if _c1 && _c2 && _c3 && _c4 && _c5 && _c6 && _c7 {
|
||||
return Api.account.Password.password(flags: _1!, currentSalt: _2!, newSalt: _3!, newSecureSalt: _4!, secureRandom: _5!, hint: _6!, emailUnconfirmedPattern: _7!)
|
||||
}
|
||||
else {
|
||||
return nil
|
||||
@ -2309,6 +2659,35 @@ extension Api {
|
||||
return result
|
||||
})
|
||||
}
|
||||
|
||||
static func markDialogUnread(flags: Int32, peer: Api.InputDialogPeer) -> (FunctionDescription, Buffer, DeserializeFunctionResponse<Api.Bool>) {
|
||||
let buffer = Buffer()
|
||||
buffer.appendInt32(-1031349873)
|
||||
serializeInt32(flags, buffer: buffer, boxed: false)
|
||||
peer.serialize(buffer, true)
|
||||
return (FunctionDescription(name: "messages.markDialogUnread", parameters: [("flags", flags), ("peer", peer)]), buffer, DeserializeFunctionResponse { (buffer: Buffer) -> Api.Bool? in
|
||||
let reader = BufferReader(buffer)
|
||||
var result: Api.Bool?
|
||||
if let signature = reader.readInt32() {
|
||||
result = Api.parse(reader, signature: signature) as? Api.Bool
|
||||
}
|
||||
return result
|
||||
})
|
||||
}
|
||||
|
||||
static func getUnreadDialogs() -> (FunctionDescription, Buffer, DeserializeFunctionResponse<[Api.DialogPeer]>) {
|
||||
let buffer = Buffer()
|
||||
buffer.appendInt32(1530766490)
|
||||
|
||||
return (FunctionDescription(name: "messages.getUnreadDialogs", parameters: []), buffer, DeserializeFunctionResponse { (buffer: Buffer) -> [Api.DialogPeer]? in
|
||||
let reader = BufferReader(buffer)
|
||||
var result: [Api.DialogPeer]?
|
||||
if let _ = reader.readInt32() {
|
||||
result = Api.parseVector(reader, elementSignature: 0, elementType: Api.DialogPeer.self)
|
||||
}
|
||||
return result
|
||||
})
|
||||
}
|
||||
}
|
||||
struct channels {
|
||||
static func readHistory(channel: Api.InputChannel, maxId: Int32) -> (FunctionDescription, Buffer, DeserializeFunctionResponse<Api.Bool>) {
|
||||
@ -3264,6 +3643,25 @@ extension Api {
|
||||
return result
|
||||
})
|
||||
}
|
||||
|
||||
static func setSecureValueErrors(id: Api.InputUser, errors: [Api.SecureValueError]) -> (FunctionDescription, Buffer, DeserializeFunctionResponse<Api.Bool>) {
|
||||
let buffer = Buffer()
|
||||
buffer.appendInt32(-1865902923)
|
||||
id.serialize(buffer, true)
|
||||
buffer.appendInt32(481674261)
|
||||
buffer.appendInt32(Int32(errors.count))
|
||||
for item in errors {
|
||||
item.serialize(buffer, true)
|
||||
}
|
||||
return (FunctionDescription(name: "users.setSecureValueErrors", parameters: [("id", id), ("errors", errors)]), buffer, DeserializeFunctionResponse { (buffer: Buffer) -> Api.Bool? in
|
||||
let reader = BufferReader(buffer)
|
||||
var result: Api.Bool?
|
||||
if let signature = reader.readInt32() {
|
||||
result = Api.parse(reader, signature: signature) as? Api.Bool
|
||||
}
|
||||
return result
|
||||
})
|
||||
}
|
||||
}
|
||||
struct contacts {
|
||||
static func getStatuses() -> (FunctionDescription, Buffer, DeserializeFunctionResponse<[Api.ContactStatus]>) {
|
||||
@ -3695,6 +4093,20 @@ extension Api {
|
||||
return result
|
||||
})
|
||||
}
|
||||
|
||||
static func getDeepLinkInfo(path: String) -> (FunctionDescription, Buffer, DeserializeFunctionResponse<Api.help.DeepLinkInfo>) {
|
||||
let buffer = Buffer()
|
||||
buffer.appendInt32(1072547679)
|
||||
serializeString(path, buffer: buffer, boxed: false)
|
||||
return (FunctionDescription(name: "help.getDeepLinkInfo", parameters: [("path", path)]), buffer, DeserializeFunctionResponse { (buffer: Buffer) -> Api.help.DeepLinkInfo? in
|
||||
let reader = BufferReader(buffer)
|
||||
var result: Api.help.DeepLinkInfo?
|
||||
if let signature = reader.readInt32() {
|
||||
result = Api.parse(reader, signature: signature) as? Api.help.DeepLinkInfo
|
||||
}
|
||||
return result
|
||||
})
|
||||
}
|
||||
}
|
||||
struct updates {
|
||||
static func getState() -> (FunctionDescription, Buffer, DeserializeFunctionResponse<Api.updates.State>) {
|
||||
@ -4327,6 +4739,170 @@ extension Api {
|
||||
return result
|
||||
})
|
||||
}
|
||||
|
||||
static func getAllSecureValues() -> (FunctionDescription, Buffer, DeserializeFunctionResponse<[Api.SecureValue]>) {
|
||||
let buffer = Buffer()
|
||||
buffer.appendInt32(-1299661699)
|
||||
|
||||
return (FunctionDescription(name: "account.getAllSecureValues", parameters: []), buffer, DeserializeFunctionResponse { (buffer: Buffer) -> [Api.SecureValue]? in
|
||||
let reader = BufferReader(buffer)
|
||||
var result: [Api.SecureValue]?
|
||||
if let _ = reader.readInt32() {
|
||||
result = Api.parseVector(reader, elementSignature: 0, elementType: Api.SecureValue.self)
|
||||
}
|
||||
return result
|
||||
})
|
||||
}
|
||||
|
||||
static func getSecureValue(types: [Api.SecureValueType]) -> (FunctionDescription, Buffer, DeserializeFunctionResponse<[Api.SecureValue]>) {
|
||||
let buffer = Buffer()
|
||||
buffer.appendInt32(1936088002)
|
||||
buffer.appendInt32(481674261)
|
||||
buffer.appendInt32(Int32(types.count))
|
||||
for item in types {
|
||||
item.serialize(buffer, true)
|
||||
}
|
||||
return (FunctionDescription(name: "account.getSecureValue", parameters: [("types", types)]), buffer, DeserializeFunctionResponse { (buffer: Buffer) -> [Api.SecureValue]? in
|
||||
let reader = BufferReader(buffer)
|
||||
var result: [Api.SecureValue]?
|
||||
if let _ = reader.readInt32() {
|
||||
result = Api.parseVector(reader, elementSignature: 0, elementType: Api.SecureValue.self)
|
||||
}
|
||||
return result
|
||||
})
|
||||
}
|
||||
|
||||
static func saveSecureValue(value: Api.InputSecureValue, secureSecretId: Int64) -> (FunctionDescription, Buffer, DeserializeFunctionResponse<Api.SecureValue>) {
|
||||
let buffer = Buffer()
|
||||
buffer.appendInt32(-1986010339)
|
||||
value.serialize(buffer, true)
|
||||
serializeInt64(secureSecretId, buffer: buffer, boxed: false)
|
||||
return (FunctionDescription(name: "account.saveSecureValue", parameters: [("value", value), ("secureSecretId", secureSecretId)]), buffer, DeserializeFunctionResponse { (buffer: Buffer) -> Api.SecureValue? in
|
||||
let reader = BufferReader(buffer)
|
||||
var result: Api.SecureValue?
|
||||
if let signature = reader.readInt32() {
|
||||
result = Api.parse(reader, signature: signature) as? Api.SecureValue
|
||||
}
|
||||
return result
|
||||
})
|
||||
}
|
||||
|
||||
static func deleteSecureValue(types: [Api.SecureValueType]) -> (FunctionDescription, Buffer, DeserializeFunctionResponse<Api.Bool>) {
|
||||
let buffer = Buffer()
|
||||
buffer.appendInt32(-1199522741)
|
||||
buffer.appendInt32(481674261)
|
||||
buffer.appendInt32(Int32(types.count))
|
||||
for item in types {
|
||||
item.serialize(buffer, true)
|
||||
}
|
||||
return (FunctionDescription(name: "account.deleteSecureValue", parameters: [("types", types)]), buffer, DeserializeFunctionResponse { (buffer: Buffer) -> Api.Bool? in
|
||||
let reader = BufferReader(buffer)
|
||||
var result: Api.Bool?
|
||||
if let signature = reader.readInt32() {
|
||||
result = Api.parse(reader, signature: signature) as? Api.Bool
|
||||
}
|
||||
return result
|
||||
})
|
||||
}
|
||||
|
||||
static func getAuthorizationForm(botId: Int32, scope: String, publicKey: String) -> (FunctionDescription, Buffer, DeserializeFunctionResponse<Api.account.AuthorizationForm>) {
|
||||
let buffer = Buffer()
|
||||
buffer.appendInt32(-1200903967)
|
||||
serializeInt32(botId, buffer: buffer, boxed: false)
|
||||
serializeString(scope, buffer: buffer, boxed: false)
|
||||
serializeString(publicKey, buffer: buffer, boxed: false)
|
||||
return (FunctionDescription(name: "account.getAuthorizationForm", parameters: [("botId", botId), ("scope", scope), ("publicKey", publicKey)]), buffer, DeserializeFunctionResponse { (buffer: Buffer) -> Api.account.AuthorizationForm? in
|
||||
let reader = BufferReader(buffer)
|
||||
var result: Api.account.AuthorizationForm?
|
||||
if let signature = reader.readInt32() {
|
||||
result = Api.parse(reader, signature: signature) as? Api.account.AuthorizationForm
|
||||
}
|
||||
return result
|
||||
})
|
||||
}
|
||||
|
||||
static func acceptAuthorization(botId: Int32, scope: String, publicKey: String, valueHashes: [Api.SecureValueHash], credentials: Api.SecureCredentialsEncrypted) -> (FunctionDescription, Buffer, DeserializeFunctionResponse<Api.Bool>) {
|
||||
let buffer = Buffer()
|
||||
buffer.appendInt32(-419267436)
|
||||
serializeInt32(botId, buffer: buffer, boxed: false)
|
||||
serializeString(scope, buffer: buffer, boxed: false)
|
||||
serializeString(publicKey, buffer: buffer, boxed: false)
|
||||
buffer.appendInt32(481674261)
|
||||
buffer.appendInt32(Int32(valueHashes.count))
|
||||
for item in valueHashes {
|
||||
item.serialize(buffer, true)
|
||||
}
|
||||
credentials.serialize(buffer, true)
|
||||
return (FunctionDescription(name: "account.acceptAuthorization", parameters: [("botId", botId), ("scope", scope), ("publicKey", publicKey), ("valueHashes", valueHashes), ("credentials", credentials)]), buffer, DeserializeFunctionResponse { (buffer: Buffer) -> Api.Bool? in
|
||||
let reader = BufferReader(buffer)
|
||||
var result: Api.Bool?
|
||||
if let signature = reader.readInt32() {
|
||||
result = Api.parse(reader, signature: signature) as? Api.Bool
|
||||
}
|
||||
return result
|
||||
})
|
||||
}
|
||||
|
||||
static func sendVerifyPhoneCode(flags: Int32, phoneNumber: String, currentNumber: Api.Bool?) -> (FunctionDescription, Buffer, DeserializeFunctionResponse<Api.auth.SentCode>) {
|
||||
let buffer = Buffer()
|
||||
buffer.appendInt32(-2110553932)
|
||||
serializeInt32(flags, buffer: buffer, boxed: false)
|
||||
serializeString(phoneNumber, buffer: buffer, boxed: false)
|
||||
if Int(flags) & Int(1 << 0) != 0 {currentNumber!.serialize(buffer, true)}
|
||||
return (FunctionDescription(name: "account.sendVerifyPhoneCode", parameters: [("flags", flags), ("phoneNumber", phoneNumber), ("currentNumber", currentNumber)]), buffer, DeserializeFunctionResponse { (buffer: Buffer) -> Api.auth.SentCode? in
|
||||
let reader = BufferReader(buffer)
|
||||
var result: Api.auth.SentCode?
|
||||
if let signature = reader.readInt32() {
|
||||
result = Api.parse(reader, signature: signature) as? Api.auth.SentCode
|
||||
}
|
||||
return result
|
||||
})
|
||||
}
|
||||
|
||||
static func verifyPhone(phoneNumber: String, phoneCodeHash: String, phoneCode: String) -> (FunctionDescription, Buffer, DeserializeFunctionResponse<Api.Bool>) {
|
||||
let buffer = Buffer()
|
||||
buffer.appendInt32(1305716726)
|
||||
serializeString(phoneNumber, buffer: buffer, boxed: false)
|
||||
serializeString(phoneCodeHash, buffer: buffer, boxed: false)
|
||||
serializeString(phoneCode, buffer: buffer, boxed: false)
|
||||
return (FunctionDescription(name: "account.verifyPhone", parameters: [("phoneNumber", phoneNumber), ("phoneCodeHash", phoneCodeHash), ("phoneCode", phoneCode)]), buffer, DeserializeFunctionResponse { (buffer: Buffer) -> Api.Bool? in
|
||||
let reader = BufferReader(buffer)
|
||||
var result: Api.Bool?
|
||||
if let signature = reader.readInt32() {
|
||||
result = Api.parse(reader, signature: signature) as? Api.Bool
|
||||
}
|
||||
return result
|
||||
})
|
||||
}
|
||||
|
||||
static func sendVerifyEmailCode(email: String) -> (FunctionDescription, Buffer, DeserializeFunctionResponse<Api.account.SentEmailCode>) {
|
||||
let buffer = Buffer()
|
||||
buffer.appendInt32(1880182943)
|
||||
serializeString(email, buffer: buffer, boxed: false)
|
||||
return (FunctionDescription(name: "account.sendVerifyEmailCode", parameters: [("email", email)]), buffer, DeserializeFunctionResponse { (buffer: Buffer) -> Api.account.SentEmailCode? in
|
||||
let reader = BufferReader(buffer)
|
||||
var result: Api.account.SentEmailCode?
|
||||
if let signature = reader.readInt32() {
|
||||
result = Api.parse(reader, signature: signature) as? Api.account.SentEmailCode
|
||||
}
|
||||
return result
|
||||
})
|
||||
}
|
||||
|
||||
static func verifyEmail(email: String, code: String) -> (FunctionDescription, Buffer, DeserializeFunctionResponse<Api.Bool>) {
|
||||
let buffer = Buffer()
|
||||
buffer.appendInt32(-323339813)
|
||||
serializeString(email, buffer: buffer, boxed: false)
|
||||
serializeString(code, buffer: buffer, boxed: false)
|
||||
return (FunctionDescription(name: "account.verifyEmail", parameters: [("email", email), ("code", code)]), buffer, DeserializeFunctionResponse { (buffer: Buffer) -> Api.Bool? in
|
||||
let reader = BufferReader(buffer)
|
||||
var result: Api.Bool?
|
||||
if let signature = reader.readInt32() {
|
||||
result = Api.parse(reader, signature: signature) as? Api.Bool
|
||||
}
|
||||
return result
|
||||
})
|
||||
}
|
||||
}
|
||||
struct langpack {
|
||||
static func getLangPack(langCode: String) -> (FunctionDescription, Buffer, DeserializeFunctionResponse<Api.LangPackDifference>) {
|
||||
|
||||
@ -113,3 +113,25 @@ func applySecretOutgoingMessageReadActions(modifier: Modifier, id: MessageId, be
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public func togglePeerUnreadMarkInteractively(postbox: Postbox, peerId: PeerId) -> Signal<Void, NoError> {
|
||||
return postbox.modify { modifier -> Void in
|
||||
let namespace: MessageId.Namespace
|
||||
if peerId.namespace == Namespaces.Peer.SecretChat {
|
||||
namespace = Namespaces.Message.SecretIncoming
|
||||
} else {
|
||||
namespace = Namespaces.Message.Cloud
|
||||
}
|
||||
if let states = modifier.getPeerReadStates(peerId) {
|
||||
for i in 0 ..< states.count {
|
||||
if states[i].0 == namespace {
|
||||
if states[i].1.isUnread {
|
||||
let _ = modifier.applyInteractiveReadMaxIndex(MessageIndex(id: MessageId(peerId: peerId, namespace: namespace, id: 1), timestamp: 1))
|
||||
} else {
|
||||
modifier.applyMarkUnread(peerId: peerId, namespace: namespace, value: true, interactive: true)
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@ -156,7 +156,7 @@ public func authorizeWithCode(account: UnauthorizedAccount, code: String) -> Sig
|
||||
switch result {
|
||||
case .noPassword:
|
||||
return .fail(.generic)
|
||||
case let .password(_, _, hint, _, _):
|
||||
case let .password(_, _, _, _, _, hint, _):
|
||||
return .single(.password(hint: hint))
|
||||
}
|
||||
}
|
||||
|
||||
@ -50,7 +50,7 @@ private func hashForCountAndIds(count: Int32, ids: [Int32]) -> Int32 {
|
||||
|
||||
func manageContacts(network: Network, postbox: Postbox) -> Signal<Void, NoError> {
|
||||
#if os(iOS) && DEBUG
|
||||
//return .never()
|
||||
return .never()
|
||||
#endif
|
||||
let initialContactPeerIdsHash = postbox.contactPeerIdsView()
|
||||
|> take(1)
|
||||
|
||||
@ -62,7 +62,7 @@ NSData * _Nullable CryptoAES(bool encrypt, NSData * _Nonnull key, NSData * _Nonn
|
||||
if (key.length != 32) {
|
||||
return nil;
|
||||
}
|
||||
if (iv.length != 32) {
|
||||
if (iv.length != 16) {
|
||||
return nil;
|
||||
}
|
||||
NSMutableData *processedData = [[NSMutableData alloc] initWithLength:data.length];
|
||||
|
||||
@ -64,6 +64,7 @@ private func parseDialogs(apiDialogs: [Api.Dialog], apiMessages: [Api.Message],
|
||||
let apiReadOutboxMaxId: Int32
|
||||
let apiTopMessage: Int32
|
||||
let apiUnreadCount: Int32
|
||||
let apiMarkedUnread: Bool
|
||||
let apiUnreadMentionsCount: Int32
|
||||
var apiChannelPts: Int32?
|
||||
let apiNotificationSettings: Api.PeerNotifySettings
|
||||
@ -75,6 +76,7 @@ private func parseDialogs(apiDialogs: [Api.Dialog], apiMessages: [Api.Message],
|
||||
apiReadInboxMaxId = readInboxMaxId
|
||||
apiReadOutboxMaxId = readOutboxMaxId
|
||||
apiUnreadCount = unreadCount
|
||||
apiMarkedUnread = (flags & (1 << 3)) != 0
|
||||
apiUnreadMentionsCount = unreadMentionsCount
|
||||
apiNotificationSettings = peerNotificationSettings
|
||||
apiChannelPts = pts
|
||||
@ -95,7 +97,7 @@ private func parseDialogs(apiDialogs: [Api.Dialog], apiMessages: [Api.Message],
|
||||
if readStates[peerId] == nil {
|
||||
readStates[peerId] = [:]
|
||||
}
|
||||
readStates[peerId]![Namespaces.Message.Cloud] = .idBased(maxIncomingReadId: apiReadInboxMaxId, maxOutgoingReadId: apiReadOutboxMaxId, maxKnownId: apiTopMessage, count: apiUnreadCount)
|
||||
readStates[peerId]![Namespaces.Message.Cloud] = .idBased(maxIncomingReadId: apiReadInboxMaxId, maxOutgoingReadId: apiReadOutboxMaxId, maxKnownId: apiTopMessage, count: apiUnreadCount, markedUnread: apiMarkedUnread)
|
||||
|
||||
if apiTopMessage != 0 {
|
||||
mentionTagSummaries[peerId] = MessageHistoryTagNamespaceSummary(version: 1, count: apiUnreadMentionsCount, range: MessageHistoryTagNamespaceCountValidityRange(maxId: apiTopMessage))
|
||||
|
||||
@ -9,7 +9,7 @@ import Foundation
|
||||
import SwiftSignalKit
|
||||
#endif
|
||||
|
||||
/*func apiSecureValueType(value: SecureIdValue) -> Api.SecureValueType {
|
||||
func apiSecureValueType(value: SecureIdValue) -> Api.SecureValueType {
|
||||
let type: Api.SecureValueType
|
||||
switch value {
|
||||
case .personalDetails:
|
||||
@ -173,15 +173,14 @@ private func encryptedCredentialsData(data: Data, secretData: Data) -> (data: Da
|
||||
return nil
|
||||
}
|
||||
return (encryptedData, hash)
|
||||
}*/
|
||||
}
|
||||
|
||||
public enum GrantSecureIdAccessError {
|
||||
case generic
|
||||
}
|
||||
|
||||
public func grantSecureIdAccess(network: Network, peerId: PeerId, publicKey: String, scope: String, opaquePayload: Data, values: [SecureIdValueWithContext]) -> Signal<Void, GrantSecureIdAccessError> {
|
||||
return .never()
|
||||
/*guard peerId.namespace == Namespaces.Peer.CloudUser else {
|
||||
guard peerId.namespace == Namespaces.Peer.CloudUser else {
|
||||
return .fail(.generic)
|
||||
}
|
||||
guard let credentialsSecretData = generateSecureSecretData() else {
|
||||
@ -208,5 +207,5 @@ public func grantSecureIdAccess(network: Network, peerId: PeerId, publicKey: Str
|
||||
}
|
||||
|> mapToSignal { _ -> Signal<Void, GrantSecureIdAccessError> in
|
||||
return .complete()
|
||||
}*/
|
||||
}
|
||||
}
|
||||
|
||||
@ -99,6 +99,9 @@ private enum ManagedDeviceContactsError {
|
||||
}
|
||||
|
||||
func managedDeviceContacts(postbox: Postbox, network: Network, deviceContacts: Signal<[DeviceContact], NoError>) -> Signal<Void, NoError> {
|
||||
#if os(iOS) && DEBUG
|
||||
return .never()
|
||||
#endif
|
||||
let queue = Queue()
|
||||
|
||||
return deviceContacts
|
||||
|
||||
@ -171,10 +171,11 @@ private func synchronizePinnedChats(modifier: Modifier, postbox: Postbox, networ
|
||||
let apiReadOutboxMaxId: Int32
|
||||
let apiTopMessage: Int32
|
||||
let apiUnreadCount: Int32
|
||||
let apiMarkedUnread: Bool
|
||||
var apiChannelPts: Int32?
|
||||
let apiNotificationSettings: Api.PeerNotifySettings
|
||||
switch dialog {
|
||||
case let .dialog(_, peer, topMessage, readInboxMaxId, readOutboxMaxId, unreadCount, unreadMentionsCount, peerNotificationSettings, pts, _):
|
||||
case let .dialog(flags, peer, topMessage, readInboxMaxId, readOutboxMaxId, unreadCount, unreadMentionsCount, peerNotificationSettings, pts, _):
|
||||
if channelGroupIds[peer.peerId] != nil {
|
||||
continue loop
|
||||
}
|
||||
@ -183,6 +184,7 @@ private func synchronizePinnedChats(modifier: Modifier, postbox: Postbox, networ
|
||||
apiReadInboxMaxId = readInboxMaxId
|
||||
apiReadOutboxMaxId = readOutboxMaxId
|
||||
apiUnreadCount = unreadCount
|
||||
apiMarkedUnread = (flags & (1 << 3)) != 0
|
||||
apiNotificationSettings = peerNotificationSettings
|
||||
apiChannelPts = pts
|
||||
/*feed*/
|
||||
@ -206,7 +208,7 @@ private func synchronizePinnedChats(modifier: Modifier, postbox: Postbox, networ
|
||||
if readStates[peerId] == nil {
|
||||
readStates[peerId] = [:]
|
||||
}
|
||||
readStates[peerId]![Namespaces.Message.Cloud] = .idBased(maxIncomingReadId: apiReadInboxMaxId, maxOutgoingReadId: apiReadOutboxMaxId, maxKnownId: apiTopMessage, count: apiUnreadCount)
|
||||
readStates[peerId]![Namespaces.Message.Cloud] = .idBased(maxIncomingReadId: apiReadInboxMaxId, maxOutgoingReadId: apiReadOutboxMaxId, maxKnownId: apiTopMessage, count: apiUnreadCount, markedUnread: apiMarkedUnread)
|
||||
|
||||
if let apiChannelPts = apiChannelPts {
|
||||
chatStates[peerId] = ChannelState(pts: apiChannelPts, invalidatedPts: nil)
|
||||
|
||||
73
TelegramCore/MarkAllChatsAsRead.swift
Normal file
73
TelegramCore/MarkAllChatsAsRead.swift
Normal file
@ -0,0 +1,73 @@
|
||||
import Foundation
|
||||
#if os(macOS)
|
||||
import PostboxMac
|
||||
import SwiftSignalKitMac
|
||||
import MtProtoKitMac
|
||||
#else
|
||||
import Postbox
|
||||
import SwiftSignalKit
|
||||
import MtProtoKitDynamic
|
||||
#endif
|
||||
|
||||
public func markAllChatsAsRead(postbox: Postbox, network: Network, stateManager: AccountStateManager) -> Signal<Void, NoError> {
|
||||
return network.request(Api.functions.messages.getUnreadDialogs())
|
||||
|> map(Optional.init)
|
||||
|> `catch` { _ -> Signal<[Api.DialogPeer]?, NoError> in
|
||||
return .single(nil)
|
||||
}
|
||||
|> mapToSignal { result -> Signal<Void, NoError> in
|
||||
guard let result = result else {
|
||||
return .complete()
|
||||
}
|
||||
|
||||
return postbox.modify { modifier -> Signal<Void, NoError> in
|
||||
var signals: [Signal<Void, NoError>] = []
|
||||
for peer in result {
|
||||
switch peer {
|
||||
case let .dialogPeer(peer):
|
||||
let peerId = peer.peerId
|
||||
if peerId.namespace == Namespaces.Peer.CloudChannel {
|
||||
if let inputChannel = modifier.getPeer(peerId).flatMap(apiInputChannel) {
|
||||
signals.append(network.request(Api.functions.channels.readHistory(channel: inputChannel, maxId: Int32.max - 1))
|
||||
|> `catch` { _ -> Signal<Api.Bool, NoError> in
|
||||
return .single(.boolFalse)
|
||||
}
|
||||
|> mapToSignal { _ -> Signal<Void, NoError> in
|
||||
return .complete()
|
||||
})
|
||||
}
|
||||
} else if peerId.namespace == Namespaces.Peer.CloudUser || peerId.namespace == Namespaces.Peer.CloudGroup {
|
||||
if let inputPeer = modifier.getPeer(peerId).flatMap(apiInputPeer) {
|
||||
signals.append(network.request(Api.functions.messages.readHistory(peer: inputPeer, maxId: Int32.max - 1))
|
||||
|> map(Optional.init)
|
||||
|> `catch` { _ -> Signal<Api.messages.AffectedMessages?, NoError> in
|
||||
return .single(nil)
|
||||
}
|
||||
|> mapToSignal { result -> Signal<Void, NoError> in
|
||||
if let result = result {
|
||||
switch result {
|
||||
case let .affectedMessages(pts, ptsCount):
|
||||
stateManager.addUpdateGroups([.updatePts(pts: pts, ptsCount: ptsCount)])
|
||||
}
|
||||
}
|
||||
return .complete()
|
||||
})
|
||||
}
|
||||
} else {
|
||||
assertionFailure()
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
let applyLocally = postbox.modify { modifier -> Void in
|
||||
|
||||
}
|
||||
|
||||
return combineLatest(signals)
|
||||
|> mapToSignal { _ -> Signal<Void, NoError> in
|
||||
return .complete()
|
||||
}
|
||||
|> then(applyLocally)
|
||||
} |> switchToLatest
|
||||
}
|
||||
}
|
||||
@ -14,7 +14,7 @@ public enum RequestSecureIdFormError {
|
||||
case serverError(String)
|
||||
}
|
||||
|
||||
/*private func parseSecureValueType(_ type: Api.SecureValueType, selfie: Bool) -> SecureIdRequestedFormField {
|
||||
private func parseSecureValueType(_ type: Api.SecureValueType, selfie: Bool) -> SecureIdRequestedFormField {
|
||||
switch type {
|
||||
case .secureValueTypePersonalDetails:
|
||||
return .personalDetails
|
||||
@ -50,13 +50,13 @@ private func parseSecureData(_ value: Api.SecureData) -> (data: Data, hash: Data
|
||||
case let .secureData(data, dataHash, secret):
|
||||
return (data.makeData(), dataHash.makeData(), secret.makeData())
|
||||
}
|
||||
}*/
|
||||
}
|
||||
|
||||
struct ParsedSecureValue {
|
||||
let valueWithContext: SecureIdValueWithContext
|
||||
}
|
||||
|
||||
/*func parseSecureValue(context: SecureIdAccessContext, value: Api.SecureValue, errors: [Api.SecureValueError]) -> ParsedSecureValue? {
|
||||
func parseSecureValue(context: SecureIdAccessContext, value: Api.SecureValue, errors: [Api.SecureValueError]) -> ParsedSecureValue? {
|
||||
switch value {
|
||||
case let .secureValue(_, type, data, frontSide, reverseSide, selfie, files, plainData, hash):
|
||||
let parsedFileReferences = files.flatMap { $0.compactMap(SecureIdFileReference.init) } ?? []
|
||||
@ -221,20 +221,19 @@ struct ParsedSecureValue {
|
||||
|
||||
private func parseSecureValues(context: SecureIdAccessContext, values: [Api.SecureValue], errors: [Api.SecureValueError]) -> [SecureIdValueWithContext] {
|
||||
return values.map({ parseSecureValue(context: context, value: $0, errors: errors) }).compactMap({ $0?.valueWithContext })
|
||||
}*/
|
||||
}
|
||||
|
||||
public struct EncryptedSecureIdForm {
|
||||
public let peerId: PeerId
|
||||
public let requestedFields: [SecureIdRequestedFormField]
|
||||
public let termsUrl: String?
|
||||
|
||||
/*let encryptedValues: [Api.SecureValue]
|
||||
let errors: [Api.SecureValueError]*/
|
||||
let encryptedValues: [Api.SecureValue]
|
||||
let errors: [Api.SecureValueError]
|
||||
}
|
||||
|
||||
public func requestSecureIdForm(postbox: Postbox, network: Network, peerId: PeerId, scope: String, publicKey: String) -> Signal<EncryptedSecureIdForm, RequestSecureIdFormError> {
|
||||
return .never()
|
||||
/*if peerId.namespace != Namespaces.Peer.CloudUser {
|
||||
if peerId.namespace != Namespaces.Peer.CloudUser {
|
||||
return .fail(.serverError("PEER IS NOT A BOT"))
|
||||
}
|
||||
return network.request(Api.functions.account.getAuthorizationForm(botId: peerId.id, scope: scope, publicKey: publicKey))
|
||||
@ -259,10 +258,9 @@ public func requestSecureIdForm(postbox: Postbox, network: Network, peerId: Peer
|
||||
}, termsUrl: termsUrl, encryptedValues: values, errors: errors)
|
||||
}
|
||||
} |> mapError { _ in return RequestSecureIdFormError.generic }
|
||||
}*/
|
||||
}
|
||||
}
|
||||
|
||||
public func decryptedSecureIdForm(context: SecureIdAccessContext, form: EncryptedSecureIdForm) -> SecureIdForm? {
|
||||
return nil
|
||||
//return SecureIdForm(peerId: form.peerId, requestedFields: form.requestedFields, values: parseSecureValues(context: context, values: form.encryptedValues, errors: form.errors))
|
||||
return SecureIdForm(peerId: form.peerId, requestedFields: form.requestedFields, values: parseSecureValues(context: context, values: form.encryptedValues, errors: form.errors))
|
||||
}
|
||||
|
||||
@ -87,7 +87,7 @@ func decryptedSecureValueData(context: SecureIdValueAccessContext, encryptedData
|
||||
return unpaddedValueData
|
||||
}
|
||||
|
||||
/*private func apiInputSecretFile(_ file: SecureIdVerificationDocumentReference) -> Api.InputSecureFile {
|
||||
private func apiInputSecretFile(_ file: SecureIdVerificationDocumentReference) -> Api.InputSecureFile {
|
||||
switch file {
|
||||
case let .remote(file):
|
||||
return Api.InputSecureFile.inputSecureFile(id: file.id, accessHash: file.accessHash)
|
||||
@ -202,11 +202,10 @@ private func makeInputSecureValue(context: SecureIdAccessContext, value: SecureI
|
||||
}
|
||||
|
||||
return Api.InputSecureValue.inputSecureValue(flags: flags, type: inputData.type, data: secureData, frontSide: inputData.frontSideReference.flatMap(apiInputSecretFile), reverseSide: inputData.backSideReference.flatMap(apiInputSecretFile), selfie: inputData.selfieReference.flatMap(apiInputSecretFile), files: files, plainData: inputData.publicData)
|
||||
}*/
|
||||
}
|
||||
|
||||
public func saveSecureIdValue(postbox: Postbox, network: Network, context: SecureIdAccessContext, value: SecureIdValue, uploadedFiles: [Data: Data]) -> Signal<SecureIdValueWithContext, SaveSecureIdValueError> {
|
||||
return .never()
|
||||
/*let delete = deleteSecureIdValues(network: network, keys: Set([value.key]))
|
||||
let delete = deleteSecureIdValues(network: network, keys: Set([value.key]))
|
||||
|> mapError { _ -> SaveSecureIdValueError in
|
||||
return .generic
|
||||
}
|
||||
@ -246,7 +245,7 @@ public func saveSecureIdValue(postbox: Postbox, network: Network, context: Secur
|
||||
return .single(parsedValue.valueWithContext)
|
||||
}
|
||||
|
||||
return delete |> then(save)*/
|
||||
return delete |> then(save)
|
||||
}
|
||||
|
||||
public enum DeleteSecureIdValueError {
|
||||
@ -254,19 +253,17 @@ public enum DeleteSecureIdValueError {
|
||||
}
|
||||
|
||||
public func deleteSecureIdValues(network: Network, keys: Set<SecureIdValueKey>) -> Signal<Void, DeleteSecureIdValueError> {
|
||||
return .never()
|
||||
/*return network.request(Api.functions.account.deleteSecureValue(types: keys.map(apiSecureValueType(key:))))
|
||||
return network.request(Api.functions.account.deleteSecureValue(types: keys.map(apiSecureValueType(key:))))
|
||||
|> mapError { _ -> DeleteSecureIdValueError in
|
||||
return .generic
|
||||
}
|
||||
|> mapToSignal { _ -> Signal<Void, DeleteSecureIdValueError> in
|
||||
return .complete()
|
||||
}*/
|
||||
}
|
||||
}
|
||||
|
||||
public func dropSecureId(network: Network, currentPassword: String) -> Signal<Void, AuthorizationPasswordVerificationError> {
|
||||
return .never()
|
||||
/*return twoStepAuthData(network)
|
||||
return twoStepAuthData(network)
|
||||
|> mapError { _ -> AuthorizationPasswordVerificationError in
|
||||
return .generic
|
||||
}
|
||||
@ -295,5 +292,5 @@ public func dropSecureId(network: Network, currentPassword: String) -> Signal<Vo
|
||||
return network.request(Api.functions.account.updatePasswordSettings(currentPasswordHash: currentPasswordHash, newSettings: Api.account.PasswordInputSettings.passwordInputSettings(flags: flags, newSalt: secureSalt, newPasswordHash: currentPasswordHash, hint: nil, email: email, newSecureSalt: secureSalt, newSecureSecret: nil, newSecureSecretId: nil)), automaticFloodWait: false) |> map {_ in} |> mapError {_ in return AuthorizationPasswordVerificationError.generic}
|
||||
}
|
||||
}
|
||||
}*/
|
||||
}
|
||||
}
|
||||
|
||||
@ -45,8 +45,7 @@ public class SecureFileMediaResource: TelegramCloudMediaResource, TelegramMultip
|
||||
}
|
||||
|
||||
var apiInputLocation: Api.InputFileLocation {
|
||||
preconditionFailure()
|
||||
//return Api.InputFileLocation.inputSecureFileLocation(id: self.file.id, accessHash: self.file.accessHash)
|
||||
return Api.InputFileLocation.inputSecureFileLocation(id: self.file.id, accessHash: self.file.accessHash)
|
||||
}
|
||||
|
||||
public init(file: SecureIdFileReference) {
|
||||
|
||||
@ -27,7 +27,7 @@ public struct SecureIdFileReference: Equatable {
|
||||
let encryptedSecret: Data
|
||||
}
|
||||
|
||||
/*extension SecureIdFileReference {
|
||||
extension SecureIdFileReference {
|
||||
init?(apiFile: Api.SecureFile) {
|
||||
switch apiFile {
|
||||
case let .secureFile(id, accessHash, size, dcId, date, fileHash, secret):
|
||||
@ -36,7 +36,7 @@ public struct SecureIdFileReference: Equatable {
|
||||
return nil
|
||||
}
|
||||
}
|
||||
}*/
|
||||
}
|
||||
|
||||
extension SecureIdGender {
|
||||
init?(serializedString: String) {
|
||||
|
||||
@ -5,13 +5,15 @@ public struct SecureIdPersonalDetailsValue: Equatable {
|
||||
public var lastName: String
|
||||
public var birthdate: SecureIdDate
|
||||
public var countryCode: String
|
||||
public var residenceCountryCode: String
|
||||
public var gender: SecureIdGender
|
||||
|
||||
public init(firstName: String, lastName: String, birthdate: SecureIdDate, countryCode: String, gender: SecureIdGender) {
|
||||
public init(firstName: String, lastName: String, birthdate: SecureIdDate, countryCode: String, residenceCountryCode: String, gender: SecureIdGender) {
|
||||
self.firstName = firstName
|
||||
self.lastName = lastName
|
||||
self.birthdate = birthdate
|
||||
self.countryCode = countryCode
|
||||
self.residenceCountryCode = residenceCountryCode
|
||||
self.gender = gender
|
||||
}
|
||||
|
||||
@ -28,6 +30,9 @@ public struct SecureIdPersonalDetailsValue: Equatable {
|
||||
if lhs.countryCode != rhs.countryCode {
|
||||
return false
|
||||
}
|
||||
if lhs.residenceCountryCode != rhs.residenceCountryCode {
|
||||
return false
|
||||
}
|
||||
if lhs.gender != rhs.gender {
|
||||
return false
|
||||
}
|
||||
@ -52,8 +57,11 @@ extension SecureIdPersonalDetailsValue {
|
||||
guard let countryCode = dict["country_code"] as? String else {
|
||||
return nil
|
||||
}
|
||||
guard let residenceCountryCode = dict["residence_country_code"] as? String else {
|
||||
return nil
|
||||
}
|
||||
|
||||
self.init(firstName: firstName, lastName: lastName, birthdate: birthdate, countryCode: countryCode, gender: gender)
|
||||
self.init(firstName: firstName, lastName: lastName, birthdate: birthdate, countryCode: countryCode, residenceCountryCode: residenceCountryCode, gender: gender)
|
||||
}
|
||||
|
||||
func serialize() -> ([String: Any], [SecureIdVerificationDocumentReference]) {
|
||||
@ -63,6 +71,7 @@ extension SecureIdPersonalDetailsValue {
|
||||
dict["birth_date"] = self.birthdate.serialize()
|
||||
dict["gender"] = self.gender.serialize()
|
||||
dict["country_code"] = self.countryCode
|
||||
dict["residenceCountryCode"] = self.residenceCountryCode
|
||||
|
||||
return (dict, [])
|
||||
}
|
||||
|
||||
@ -24,6 +24,7 @@ public enum SecureIdValueContentErrorPersonalDetailsField: String, Hashable {
|
||||
case birthdate = "birth_date"
|
||||
case gender = "gender"
|
||||
case countryCode = "country_code"
|
||||
case residenceCountryCode = "residence_country_code"
|
||||
}
|
||||
|
||||
public enum SecureIdValueContentErrorPassportField: String, Hashable {
|
||||
@ -57,7 +58,7 @@ public enum SecureIdValueContentErrorAddressField: String, Hashable {
|
||||
|
||||
public typealias SecureIdValueContentError = String
|
||||
|
||||
/*func parseSecureIdValueContentErrors(dataHash: Data?, fileHashes: Set<Data>, selfieHash: Data?, frontSideHash: Data?, backSideHash: Data?, errors: [Api.SecureValueError]) -> [SecureIdValueContentErrorKey: SecureIdValueContentError] {
|
||||
func parseSecureIdValueContentErrors(dataHash: Data?, fileHashes: Set<Data>, selfieHash: Data?, frontSideHash: Data?, backSideHash: Data?, errors: [Api.SecureValueError]) -> [SecureIdValueContentErrorKey: SecureIdValueContentError] {
|
||||
var result: [SecureIdValueContentErrorKey: SecureIdValueContentError] = [:]
|
||||
for error in errors {
|
||||
switch error {
|
||||
@ -122,4 +123,4 @@ public typealias SecureIdValueContentError = String
|
||||
}
|
||||
}
|
||||
return result
|
||||
}*/
|
||||
}
|
||||
|
||||
@ -208,7 +208,7 @@ public class BoxedMessage: NSObject {
|
||||
|
||||
public class Serialization: NSObject, MTSerialization {
|
||||
public func currentLayer() -> UInt {
|
||||
return 80
|
||||
return 81
|
||||
}
|
||||
|
||||
public func parseMessage(_ data: Data!) -> Any! {
|
||||
|
||||
@ -204,7 +204,7 @@ func apiMessagePeerIds(_ message: Api.Message) -> [PeerId] {
|
||||
}
|
||||
|
||||
switch action {
|
||||
case .messageActionChannelCreate, .messageActionChatDeletePhoto, .messageActionChatEditPhoto, .messageActionChatEditTitle, .messageActionEmpty, .messageActionPinMessage, .messageActionHistoryClear, .messageActionGameScore, .messageActionPaymentSent, .messageActionPaymentSentMe, .messageActionPhoneCall, .messageActionScreenshotTaken, .messageActionCustomAction, .messageActionBotAllowed/*, .messageActionSecureValuesSent, .messageActionSecureValuesSentMe*/:
|
||||
case .messageActionChannelCreate, .messageActionChatDeletePhoto, .messageActionChatEditPhoto, .messageActionChatEditTitle, .messageActionEmpty, .messageActionPinMessage, .messageActionHistoryClear, .messageActionGameScore, .messageActionPaymentSent, .messageActionPaymentSentMe, .messageActionPhoneCall, .messageActionScreenshotTaken, .messageActionCustomAction, .messageActionBotAllowed, .messageActionSecureValuesSent, .messageActionSecureValuesSentMe:
|
||||
break
|
||||
case let .messageActionChannelMigrateFrom(_, chatId):
|
||||
result.append(PeerId(namespace: Namespaces.Peer.CloudGroup, id: chatId))
|
||||
|
||||
@ -75,19 +75,21 @@ func fetchPeerCloudReadState(network: Network, postbox: Postbox, peerId: PeerId,
|
||||
let apiReadInboxMaxId: Int32
|
||||
let apiReadOutboxMaxId: Int32
|
||||
let apiUnreadCount: Int32
|
||||
let apiMarkedUnread: Bool
|
||||
switch dialog {
|
||||
case let .dialog(_, _, topMessage, readInboxMaxId, readOutboxMaxId, unreadCount, _, _, _, _):
|
||||
case let .dialog(flags, _, topMessage, readInboxMaxId, readOutboxMaxId, unreadCount, _, _, _, _):
|
||||
apiTopMessage = topMessage
|
||||
apiReadInboxMaxId = readInboxMaxId
|
||||
apiReadOutboxMaxId = readOutboxMaxId
|
||||
apiUnreadCount = unreadCount
|
||||
apiMarkedUnread = (flags & (1 << 3)) != 0
|
||||
/*feed*/
|
||||
/*case .dialogFeed:
|
||||
assertionFailure()
|
||||
return nil*/
|
||||
}
|
||||
|
||||
return .idBased(maxIncomingReadId: apiReadInboxMaxId, maxOutgoingReadId: apiReadOutboxMaxId, maxKnownId: apiTopMessage, count: apiUnreadCount)
|
||||
return .idBased(maxIncomingReadId: apiReadInboxMaxId, maxOutgoingReadId: apiReadOutboxMaxId, maxKnownId: apiTopMessage, count: apiUnreadCount, markedUnread: apiMarkedUnread)
|
||||
} else {
|
||||
return nil
|
||||
}
|
||||
@ -113,13 +115,15 @@ private func dialogReadState(network: Network, postbox: Postbox, peerId: PeerId)
|
||||
let apiReadInboxMaxId: Int32
|
||||
let apiReadOutboxMaxId: Int32
|
||||
let apiUnreadCount: Int32
|
||||
let apiMarkedUnread: Bool
|
||||
var apiChannelPts: Int32 = 0
|
||||
switch dialog {
|
||||
case let .dialog(_, _, topMessage, readInboxMaxId, readOutboxMaxId, unreadCount, _, _, pts, _):
|
||||
case let .dialog(flags, _, topMessage, readInboxMaxId, readOutboxMaxId, unreadCount, _, _, pts, _):
|
||||
apiTopMessage = topMessage
|
||||
apiReadInboxMaxId = readInboxMaxId
|
||||
apiReadOutboxMaxId = readOutboxMaxId
|
||||
apiUnreadCount = unreadCount
|
||||
apiMarkedUnread = (flags & (1 << 3)) != 0
|
||||
if let pts = pts {
|
||||
apiChannelPts = pts
|
||||
}
|
||||
@ -142,7 +146,7 @@ private func dialogReadState(network: Network, postbox: Postbox, peerId: PeerId)
|
||||
marker = .Global(pts)
|
||||
}
|
||||
|
||||
return .single((.idBased(maxIncomingReadId: apiReadInboxMaxId, maxOutgoingReadId: apiReadOutboxMaxId, maxKnownId: apiTopMessage, count: apiUnreadCount), marker))
|
||||
return .single((.idBased(maxIncomingReadId: apiReadInboxMaxId, maxOutgoingReadId: apiReadOutboxMaxId, maxKnownId: apiTopMessage, count: apiUnreadCount, markedUnread: apiMarkedUnread), marker))
|
||||
} else {
|
||||
return .fail(.Abort)
|
||||
}
|
||||
@ -247,7 +251,7 @@ private func pushPeerReadState(network: Network, postbox: Postbox, stateManager:
|
||||
switch readState {
|
||||
case .idBased:
|
||||
return .single(readState)
|
||||
case let .indexBased(maxIncomingReadIndex, _, _):
|
||||
case let .indexBased(maxIncomingReadIndex, _, _, _):
|
||||
return network.request(Api.functions.messages.readEncryptedHistory(peer: inputPeer, maxDate: maxIncomingReadIndex.timestamp))
|
||||
|> retryRequest
|
||||
|> mapToSignalPromotingError { _ -> Signal<PeerReadState, VerifyReadStateError> in
|
||||
@ -261,29 +265,69 @@ private func pushPeerReadState(network: Network, postbox: Postbox, stateManager:
|
||||
switch inputPeer {
|
||||
case let .inputPeerChannel(channelId, accessHash):
|
||||
switch readState {
|
||||
case let .idBased(maxIncomingReadId, _, _, _):
|
||||
return network.request(Api.functions.channels.readHistory(channel: Api.InputChannel.inputChannel(channelId: channelId, accessHash: accessHash), maxId: maxIncomingReadId))
|
||||
|> retryRequest
|
||||
|> mapToSignalPromotingError { _ -> Signal<PeerReadState, VerifyReadStateError> in
|
||||
return .single(readState)
|
||||
case let .idBased(maxIncomingReadId, _, _, _, markedUnread):
|
||||
var pushSignals: [Signal<Void, NoError>] = []
|
||||
pushSignals.append(network.request(Api.functions.channels.readHistory(channel: Api.InputChannel.inputChannel(channelId: channelId, accessHash: accessHash), maxId: maxIncomingReadId))
|
||||
|> `catch` { _ -> Signal<Api.Bool, NoError> in
|
||||
return .complete()
|
||||
}
|
||||
|> mapToSignal { _ -> Signal<Void, NoError> in
|
||||
return .complete()
|
||||
})
|
||||
if markedUnread {
|
||||
pushSignals.append(network.request(Api.functions.messages.markDialogUnread(flags: 1 << 0, peer: .inputDialogPeer(peer: inputPeer)))
|
||||
|> `catch` { _ -> Signal<Api.Bool, NoError> in
|
||||
return .complete()
|
||||
}
|
||||
|> mapToSignal { _ -> Signal<Void, NoError> in
|
||||
return .complete()
|
||||
})
|
||||
}
|
||||
return combineLatest(pushSignals)
|
||||
|> mapError { _ -> VerifyReadStateError in return VerifyReadStateError.Retry }
|
||||
|> mapToSignal { _ -> Signal<PeerReadState, VerifyReadStateError> in
|
||||
return .complete()
|
||||
}
|
||||
|> then(Signal<PeerReadState, VerifyReadStateError>.single(readState))
|
||||
case .indexBased:
|
||||
return .single(readState)
|
||||
}
|
||||
|
||||
default:
|
||||
switch readState {
|
||||
case let .idBased(maxIncomingReadId, _, _, _):
|
||||
return network.request(Api.functions.messages.readHistory(peer: inputPeer, maxId: maxIncomingReadId))
|
||||
|> retryRequest
|
||||
|> mapToSignalPromotingError { result -> Signal<PeerReadState, VerifyReadStateError>
|
||||
in
|
||||
case let .idBased(maxIncomingReadId, _, _, _, markedUnread):
|
||||
var pushSignals: [Signal<Void, NoError>] = []
|
||||
pushSignals.append(network.request(Api.functions.messages.readHistory(peer: inputPeer, maxId: maxIncomingReadId))
|
||||
|> map(Optional.init)
|
||||
|> `catch` { _ -> Signal<Api.messages.AffectedMessages?, NoError> in
|
||||
return .single(nil)
|
||||
}
|
||||
|> mapToSignal { result -> Signal<Void, NoError> in
|
||||
if let result = result {
|
||||
switch result {
|
||||
case let .affectedMessages(pts, ptsCount):
|
||||
stateManager.addUpdateGroups([.updatePts(pts: pts, ptsCount: ptsCount)])
|
||||
}
|
||||
return .single(readState)
|
||||
}
|
||||
return .complete()
|
||||
})
|
||||
|
||||
if markedUnread {
|
||||
pushSignals.append(network.request(Api.functions.messages.markDialogUnread(flags: 1 << 0, peer: .inputDialogPeer(peer: inputPeer)))
|
||||
|> `catch` { _ -> Signal<Api.Bool, NoError> in
|
||||
return .complete()
|
||||
}
|
||||
|> mapToSignal { _ -> Signal<Void, NoError> in
|
||||
return .complete()
|
||||
})
|
||||
}
|
||||
|
||||
return combineLatest(pushSignals)
|
||||
|> mapError { _ -> VerifyReadStateError in return VerifyReadStateError.Retry }
|
||||
|> mapToSignal { _ -> Signal<PeerReadState, VerifyReadStateError> in
|
||||
return .complete()
|
||||
}
|
||||
|> then(Signal<PeerReadState, VerifyReadStateError>.single(readState))
|
||||
case .indexBased:
|
||||
return .single(readState)
|
||||
}
|
||||
|
||||
@ -389,10 +389,10 @@ func telegramMediaActionFromApiAction(_ action: Api.MessageAction) -> TelegramMe
|
||||
return TelegramMediaAction(action: .customText(text: message, entities: []))
|
||||
case let .messageActionBotAllowed(domain):
|
||||
return TelegramMediaAction(action: .botDomainAccessGranted(domain: domain))
|
||||
/*case .messageActionSecureValuesSentMe:
|
||||
case .messageActionSecureValuesSentMe:
|
||||
return nil
|
||||
case let .messageActionSecureValuesSent(types):
|
||||
return TelegramMediaAction(action: .botSentSecureValues(types: types.map(SentSecureValueType.init)))*/
|
||||
return TelegramMediaAction(action: .botSentSecureValues(types: types.map(SentSecureValueType.init)))
|
||||
}
|
||||
}
|
||||
|
||||
@ -411,7 +411,7 @@ extension PhoneCallDiscardReason {
|
||||
}
|
||||
}
|
||||
|
||||
/*extension SentSecureValueType {
|
||||
extension SentSecureValueType {
|
||||
init(apiType: Api.SecureValueType) {
|
||||
switch apiType {
|
||||
case .secureValueTypePersonalDetails:
|
||||
@ -442,4 +442,4 @@ extension PhoneCallDiscardReason {
|
||||
self = .temporaryRegistration
|
||||
}
|
||||
}
|
||||
}*/
|
||||
}
|
||||
|
||||
@ -19,10 +19,10 @@ public func twoStepVerificationConfiguration(account: Account) -> Signal<TwoStep
|
||||
|> retryRequest
|
||||
|> map { result -> TwoStepVerificationConfiguration in
|
||||
switch result {
|
||||
case let .noPassword(_, emailUnconfirmedPattern):
|
||||
case let .noPassword(_, _, _, emailUnconfirmedPattern):
|
||||
return .notSet(pendingEmailPattern: emailUnconfirmedPattern)
|
||||
case let .password(_, _, hint, hasRecovery, emailUnconfirmedPattern):
|
||||
return .set(hint: hint, hasRecoveryEmail: hasRecovery == .boolTrue, pendingEmailPattern: emailUnconfirmedPattern)
|
||||
case let .password(flags, _, _, _, _, hint, emailUnconfirmedPattern):
|
||||
return .set(hint: hint, hasRecoveryEmail: (flags & (1 << 0)) != 0, pendingEmailPattern: emailUnconfirmedPattern)
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -62,14 +62,14 @@ public func requestTwoStepVerifiationSettings(network: Network, password: String
|
||||
}
|
||||
|> mapToSignal { result -> Signal<TwoStepVerificationSettings, AuthorizationPasswordVerificationError> in
|
||||
switch result {
|
||||
case let .passwordSettings(email):
|
||||
case let .passwordSettings(email, secureSalt, secureSecret, secureSecretId):
|
||||
var parsedSecureSecret: TwoStepVerificationSecureSecret?
|
||||
/*if secureSalt.size != 0 && secureSecret.size != 0 {
|
||||
if secureSalt.size != 0 && secureSecret.size != 0 {
|
||||
if secureSecret.size != 32 {
|
||||
return .fail(.generic)
|
||||
}
|
||||
parsedSecureSecret = TwoStepVerificationSecureSecret(data: secureSecret.makeData(), salt: secureSalt.makeData(), id: secureSecretId)
|
||||
}*/
|
||||
}
|
||||
return .single(TwoStepVerificationSettings(email: email, secureSecret: parsedSecureSecret))
|
||||
}
|
||||
}
|
||||
@ -130,7 +130,7 @@ public func updateTwoStepVerificationPassword(network: Network, currentPassword:
|
||||
flags |= (1 << 0)
|
||||
}
|
||||
|
||||
return network.request(Api.functions.account.updatePasswordSettings(currentPasswordHash: currentPasswordHash, newSettings: .passwordInputSettings(flags: flags, newSalt: Buffer(data: Data()), newPasswordHash: Buffer(data: Data()), hint: "", email: "")), automaticFloodWait: true)
|
||||
return network.request(Api.functions.account.updatePasswordSettings(currentPasswordHash: currentPasswordHash, newSettings: .passwordInputSettings(flags: flags, newSalt: Buffer(data: Data()), newPasswordHash: Buffer(data: Data()), hint: "", email: "", newSecureSalt: nil, newSecureSecret: nil, newSecureSecretId: nil)), automaticFloodWait: true)
|
||||
|> mapError { _ -> UpdateTwoStepVerificationPasswordError in
|
||||
return .generic
|
||||
}
|
||||
@ -157,7 +157,7 @@ public func updateTwoStepVerificationPassword(network: Network, currentPassword:
|
||||
updatedData.append(nextSalt)
|
||||
|
||||
var updatedSecureSecret: TwoStepVerificationSecureSecret?
|
||||
/*if let encryptedSecret = secureSecret {
|
||||
if let encryptedSecret = secureSecret {
|
||||
flags |= 1 << 2
|
||||
if let decryptedSecret = decryptedSecureSecret(encryptedSecretData: encryptedSecret.data, password: currentPassword ?? "", salt: encryptedSecret.salt, id: encryptedSecret.id) {
|
||||
if let (data, salt, id) = encryptedSecureSecret(secretData: decryptedSecret, password: password, inputSalt: authData.nextSecureSalt) {
|
||||
@ -168,10 +168,10 @@ public func updateTwoStepVerificationPassword(network: Network, currentPassword:
|
||||
} else {
|
||||
return .fail(.generic)
|
||||
}
|
||||
}*/
|
||||
}
|
||||
|
||||
let updatedPasswordHash = sha256Digest(updatedData)
|
||||
return network.request(Api.functions.account.updatePasswordSettings(currentPasswordHash: currentPasswordHash, newSettings: Api.account.PasswordInputSettings.passwordInputSettings(flags: flags, newSalt: Buffer(data: nextSalt), newPasswordHash: Buffer(data: updatedPasswordHash), hint: hint, email: email)), automaticFloodWait: false)
|
||||
return network.request(Api.functions.account.updatePasswordSettings(currentPasswordHash: currentPasswordHash, newSettings: Api.account.PasswordInputSettings.passwordInputSettings(flags: flags, newSalt: Buffer(data: nextSalt), newPasswordHash: Buffer(data: updatedPasswordHash), hint: hint, email: email, newSecureSalt: (updatedSecureSecret?.salt).flatMap(Buffer.init), newSecureSecret: (updatedSecureSecret?.data).flatMap(Buffer.init), newSecureSecretId: updatedSecureSecret?.id)), automaticFloodWait: false)
|
||||
|> map { _ -> UpdateTwoStepVerificationPasswordResult in
|
||||
return .password(password: password, pendingEmailPattern: nil)
|
||||
}
|
||||
@ -229,7 +229,7 @@ func updateTwoStepVerificationSecureSecret(network: Network, password: String, s
|
||||
}
|
||||
|
||||
let flags: Int32 = (1 << 2)
|
||||
return network.request(Api.functions.account.updatePasswordSettings(currentPasswordHash: currentPasswordHash, newSettings: .passwordInputSettings(flags: flags, newSalt: nil, newPasswordHash: nil, hint: nil, email: nil)), automaticFloodWait: false)
|
||||
return network.request(Api.functions.account.updatePasswordSettings(currentPasswordHash: currentPasswordHash, newSettings: .passwordInputSettings(flags: flags, newSalt: Buffer(data: Data()), newPasswordHash: Buffer(data: Data()), hint: "", email: "", newSecureSalt: nil, newSecureSecret: nil, newSecureSecretId: nil)), automaticFloodWait: true)
|
||||
|> mapError { _ -> UpdateTwoStepVerificationSecureSecretError in
|
||||
return .generic
|
||||
}
|
||||
@ -257,7 +257,7 @@ public func updateTwoStepVerificationEmail(account: Account, currentPassword: St
|
||||
}
|
||||
|
||||
let flags: Int32 = 1 << 1
|
||||
return account.network.request(Api.functions.account.updatePasswordSettings(currentPasswordHash: currentPasswordHash, newSettings: Api.account.PasswordInputSettings.passwordInputSettings(flags: flags, newSalt: nil, newPasswordHash: nil, hint: nil, email: updatedEmail)), automaticFloodWait: false)
|
||||
return account.network.request(Api.functions.account.updatePasswordSettings(currentPasswordHash: currentPasswordHash, newSettings: Api.account.PasswordInputSettings.passwordInputSettings(flags: flags, newSalt: nil, newPasswordHash: nil, hint: nil, email: updatedEmail, newSecureSalt: nil, newSecureSecret: nil, newSecureSecretId: nil)), automaticFloodWait: false)
|
||||
|> map { _ -> UpdateTwoStepVerificationPasswordResult in
|
||||
return .password(password: currentPassword, pendingEmailPattern: nil)
|
||||
}
|
||||
|
||||
@ -83,8 +83,8 @@ func updateSecretChat(accountPeerId: PeerId, modifier: Modifier, chat: Api.Encry
|
||||
let peer = TelegramSecretChat(id: chat.peerId, creationDate: date, regularPeerId: PeerId(namespace: Namespaces.Peer.CloudUser, id: adminId), accessHash: accessHash, role: updatedState.role, embeddedState: updatedState.embeddedState.peerState, messageAutoremoveTimeout: nil)
|
||||
updatePeers(modifier: modifier, peers: [peer], update: { _, updated in return updated })
|
||||
modifier.resetIncomingReadStates([peer.id: [
|
||||
Namespaces.Message.SecretIncoming: .indexBased(maxIncomingReadIndex: MessageIndex.lowerBound(peerId: peer.id), maxOutgoingReadIndex: MessageIndex.lowerBound(peerId: peer.id), count: 0),
|
||||
Namespaces.Message.Local: .indexBased(maxIncomingReadIndex: MessageIndex.lowerBound(peerId: peer.id), maxOutgoingReadIndex: MessageIndex.lowerBound(peerId: peer.id), count: 0)
|
||||
Namespaces.Message.SecretIncoming: .indexBased(maxIncomingReadIndex: MessageIndex.lowerBound(peerId: peer.id), maxOutgoingReadIndex: MessageIndex.lowerBound(peerId: peer.id), count: 0, markedUnread: false),
|
||||
Namespaces.Message.Local: .indexBased(maxIncomingReadIndex: MessageIndex.lowerBound(peerId: peer.id), maxOutgoingReadIndex: MessageIndex.lowerBound(peerId: peer.id), count: 0, markedUnread: false)
|
||||
]
|
||||
])
|
||||
} else {
|
||||
@ -100,8 +100,8 @@ func updateSecretChat(accountPeerId: PeerId, modifier: Modifier, chat: Api.Encry
|
||||
updatePeers(modifier: modifier, peers: [peer], update: { _, updated in return updated })
|
||||
modifier.setPeerChatState(peer.id, state: state)
|
||||
modifier.resetIncomingReadStates([peer.id: [
|
||||
Namespaces.Message.SecretIncoming: .indexBased(maxIncomingReadIndex: MessageIndex.lowerBound(peerId: peer.id), maxOutgoingReadIndex: MessageIndex.lowerBound(peerId: peer.id), count: 0),
|
||||
Namespaces.Message.Local: .indexBased(maxIncomingReadIndex: MessageIndex.lowerBound(peerId: peer.id), maxOutgoingReadIndex: MessageIndex.lowerBound(peerId: peer.id), count: 0)
|
||||
Namespaces.Message.SecretIncoming: .indexBased(maxIncomingReadIndex: MessageIndex.lowerBound(peerId: peer.id), maxOutgoingReadIndex: MessageIndex.lowerBound(peerId: peer.id), count: 0, markedUnread: false),
|
||||
Namespaces.Message.Local: .indexBased(maxIncomingReadIndex: MessageIndex.lowerBound(peerId: peer.id), maxOutgoingReadIndex: MessageIndex.lowerBound(peerId: peer.id), count: 0, markedUnread: false)
|
||||
]
|
||||
])
|
||||
} else {
|
||||
|
||||
@ -24,8 +24,7 @@ public struct SecureIdPreparePhoneVerificationPayload {
|
||||
}
|
||||
|
||||
public func secureIdPreparePhoneVerification(network: Network, value: SecureIdPhoneValue) -> Signal<SecureIdPreparePhoneVerificationPayload, SecureIdPreparePhoneVerificationError> {
|
||||
return .never()
|
||||
/*return network.request(Api.functions.account.sendVerifyPhoneCode(flags: 0, phoneNumber: value.phone, currentNumber: nil), automaticFloodWait: false)
|
||||
return network.request(Api.functions.account.sendVerifyPhoneCode(flags: 0, phoneNumber: value.phone, currentNumber: nil), automaticFloodWait: false)
|
||||
|> mapError { error -> SecureIdPreparePhoneVerificationError in
|
||||
if error.errorDescription.hasPrefix("FLOOD_WAIT") {
|
||||
return .flood
|
||||
@ -36,10 +35,10 @@ public func secureIdPreparePhoneVerification(network: Network, value: SecureIdPh
|
||||
}
|
||||
|> map { sentCode -> SecureIdPreparePhoneVerificationPayload in
|
||||
switch sentCode {
|
||||
case let .sentCode(_, type, phoneCodeHash, nextType, timeout):
|
||||
case let .sentCode(_, type, phoneCodeHash, nextType, timeout, _):
|
||||
return SecureIdPreparePhoneVerificationPayload(type: SentAuthorizationCodeType(apiType: type), nextType: nextType.flatMap(AuthorizationCodeNextType.init), timeout: timeout, phone: value.phone, phoneCodeHash: phoneCodeHash)
|
||||
}
|
||||
}*/
|
||||
}
|
||||
}
|
||||
|
||||
public enum SecureIdCommitPhoneVerificationError {
|
||||
@ -49,8 +48,7 @@ public enum SecureIdCommitPhoneVerificationError {
|
||||
}
|
||||
|
||||
public func secureIdCommitPhoneVerification(postbox: Postbox, network: Network, context: SecureIdAccessContext, payload: SecureIdPreparePhoneVerificationPayload, code: String) -> Signal<SecureIdValueWithContext, SecureIdCommitPhoneVerificationError> {
|
||||
return .never()
|
||||
/*return network.request(Api.functions.account.verifyPhone(phoneNumber: payload.phone, phoneCodeHash: payload.phoneCodeHash, phoneCode: code))
|
||||
return network.request(Api.functions.account.verifyPhone(phoneNumber: payload.phone, phoneCodeHash: payload.phoneCodeHash, phoneCode: code))
|
||||
|> mapError { error -> SecureIdCommitPhoneVerificationError in
|
||||
if error.errorDescription.hasPrefix("FLOOD_WAIT") {
|
||||
return .flood
|
||||
@ -65,7 +63,7 @@ public func secureIdCommitPhoneVerification(postbox: Postbox, network: Network,
|
||||
|> mapError { _ -> SecureIdCommitPhoneVerificationError in
|
||||
return .generic
|
||||
}
|
||||
}*/
|
||||
}
|
||||
}
|
||||
|
||||
public enum SecureIdPrepareEmailVerificationError {
|
||||
@ -79,8 +77,7 @@ public struct SecureIdPrepareEmailVerificationPayload {
|
||||
}
|
||||
|
||||
public func secureIdPrepareEmailVerification(network: Network, value: SecureIdEmailValue) -> Signal<SecureIdPrepareEmailVerificationPayload, SecureIdPrepareEmailVerificationError> {
|
||||
return .never()
|
||||
/*return network.request(Api.functions.account.sendVerifyEmailCode(email: value.email), automaticFloodWait: false)
|
||||
return network.request(Api.functions.account.sendVerifyEmailCode(email: value.email), automaticFloodWait: false)
|
||||
|> mapError { error -> SecureIdPrepareEmailVerificationError in
|
||||
if error.errorDescription.hasPrefix("FLOOD_WAIT") {
|
||||
return .flood
|
||||
@ -92,7 +89,7 @@ public func secureIdPrepareEmailVerification(network: Network, value: SecureIdEm
|
||||
case .sentEmailCode(_, let length):
|
||||
return SecureIdPrepareEmailVerificationPayload(email: value.email, length: length)
|
||||
}
|
||||
}*/
|
||||
}
|
||||
}
|
||||
|
||||
public enum SecureIdCommitEmailVerificationError {
|
||||
@ -102,8 +99,7 @@ public enum SecureIdCommitEmailVerificationError {
|
||||
}
|
||||
|
||||
public func secureIdCommitEmailVerification(postbox: Postbox, network: Network, context: SecureIdAccessContext, payload: SecureIdPrepareEmailVerificationPayload, code: String) -> Signal<SecureIdValueWithContext, SecureIdCommitEmailVerificationError> {
|
||||
return .never()
|
||||
/*return network.request(Api.functions.account.verifyEmail(email: payload.email, code: code), automaticFloodWait: false)
|
||||
return network.request(Api.functions.account.verifyEmail(email: payload.email, code: code), automaticFloodWait: false)
|
||||
|> mapError { error -> SecureIdCommitEmailVerificationError in
|
||||
if error.errorDescription.hasPrefix("FLOOD_WAIT") {
|
||||
return .flood
|
||||
@ -115,5 +111,5 @@ public func secureIdCommitEmailVerification(postbox: Postbox, network: Network,
|
||||
|> mapError { _ -> SecureIdCommitEmailVerificationError in
|
||||
return .generic
|
||||
}
|
||||
}*/
|
||||
}
|
||||
}
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user