mirror of
https://github.com/Swiftgram/Telegram-iOS.git
synced 2025-12-04 21:41:45 +00:00
Merge branch 'master' of https://github.com/peter-iakovlev/TelegramCore
This commit is contained in:
commit
6dd610e518
@ -274,6 +274,12 @@ public final class PendingMessageManager {
|
||||
} else {
|
||||
messageContext.state = .waitingForUploadToStart(groupId: message.groupingKey, upload: contentUploadSignal)
|
||||
}
|
||||
|
||||
if let _ = currentGroupId, message.groupingKey != currentGroupId {
|
||||
currentGroupId = nil
|
||||
} else {
|
||||
currentGroupId = message.groupingKey
|
||||
}
|
||||
}
|
||||
|
||||
if let currentGroupId = currentGroupId {
|
||||
@ -442,9 +448,9 @@ public final class PendingMessageManager {
|
||||
if let current = strongSelf.messageContexts[id] {
|
||||
strongSelf.beginSendingMessage(messageContext: current, messageId: id, groupId: groupId, content: content)
|
||||
strongSelf.updateWaitingUploads(peerId: id.peerId)
|
||||
if let groupId = groupId {
|
||||
strongSelf.beginSendingGroupIfPossible(groupId: groupId)
|
||||
}
|
||||
//if let groupId = groupId {
|
||||
// strongSelf.beginSendingGroupIfPossible(groupId: groupId)
|
||||
// }
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@ -806,14 +806,15 @@ private func parseMessage(peerId: PeerId, authorId: PeerId, tagLocalIndex: Int32
|
||||
if let file = file {
|
||||
let fileMedia = TelegramMediaFile(fileId: MediaId(namespace: Namespaces.Media.CloudSecretFile, id: file.id), partialReference: nil, resource: file.resource(key: SecretFileEncryptionKey(aesKey: key.makeData(), aesIv: iv.makeData()), decryptedSize: size), previewRepresentations: [], mimeType: mimeType, size: Int(size), attributes: [TelegramMediaFileAttribute.Audio(isVoice: true, duration: Int(duration), title: nil, performer: nil, waveform: nil)])
|
||||
parsedMedia.append(fileMedia)
|
||||
attributes.append(ConsumableContentMessageAttribute(consumed: false))
|
||||
}
|
||||
case let .decryptedMessageMediaDocument(thumb, thumbW, thumbH, mimeType, size, key, iv, attributes, caption):
|
||||
case let .decryptedMessageMediaDocument(thumb, thumbW, thumbH, mimeType, size, key, iv, decryptedAttributes, caption):
|
||||
if !caption.isEmpty {
|
||||
text = caption
|
||||
}
|
||||
if let file = file {
|
||||
var parsedAttributes: [TelegramMediaFileAttribute] = []
|
||||
for attribute in attributes {
|
||||
for attribute in decryptedAttributes {
|
||||
if let parsedAttribute = TelegramMediaFileAttribute(attribute) {
|
||||
parsedAttributes.append(parsedAttribute)
|
||||
}
|
||||
@ -826,6 +827,22 @@ private func parseMessage(peerId: PeerId, authorId: PeerId, tagLocalIndex: Int32
|
||||
}
|
||||
let fileMedia = TelegramMediaFile(fileId: MediaId(namespace: Namespaces.Media.CloudSecretFile, id: file.id), partialReference: nil, resource: file.resource(key: SecretFileEncryptionKey(aesKey: key.makeData(), aesIv: iv.makeData()), decryptedSize: size), previewRepresentations: previewRepresentations, mimeType: mimeType, size: Int(size), attributes: parsedAttributes)
|
||||
parsedMedia.append(fileMedia)
|
||||
|
||||
loop: for attr in parsedAttributes {
|
||||
switch attr {
|
||||
case let .Video(_, _, flags):
|
||||
if flags.contains(.instantRoundVideo) {
|
||||
attributes.append(ConsumableContentMessageAttribute(consumed: false))
|
||||
}
|
||||
break loop
|
||||
case let .Audio(isVoice, _, _, _, _):
|
||||
if isVoice {
|
||||
attributes.append(ConsumableContentMessageAttribute(consumed: false))
|
||||
}
|
||||
default:
|
||||
break
|
||||
}
|
||||
}
|
||||
}
|
||||
case let .decryptedMessageMediaVideo(thumb, thumbW, thumbH, duration, mimeType, w, h, size, key, iv, caption):
|
||||
if !caption.isEmpty {
|
||||
|
||||
@ -261,7 +261,7 @@ public func requestSecureIdForm(postbox: Postbox, network: Network, peerId: Peer
|
||||
|> mapToSignal { result -> Signal<EncryptedSecureIdForm, RequestSecureIdFormError> in
|
||||
return postbox.transaction { transaction -> EncryptedSecureIdForm in
|
||||
switch result {
|
||||
case let .authorizationForm(flags, requiredTypes, values, errors, users, termsUrl):
|
||||
case let .authorizationForm(_, requiredTypes, values, errors, users, termsUrl):
|
||||
var peers: [Peer] = []
|
||||
for user in users {
|
||||
let parsed = TelegramUser(user: user)
|
||||
|
||||
@ -182,7 +182,7 @@ private func makeInputSecureValue(context: SecureIdAccessContext, value: SecureI
|
||||
var flags: Int32 = 0
|
||||
|
||||
let files = inputData.fileReferences.map(apiInputSecretFile)
|
||||
let translations = inputData.translationReferences.flatMap(apiInputSecretFile)
|
||||
let translations = inputData.translationReferences.map(apiInputSecretFile)
|
||||
|
||||
if secureData != nil {
|
||||
flags |= 1 << 0
|
||||
|
||||
@ -38,53 +38,57 @@ public enum SecureIdValue: Equatable {
|
||||
if let selfie = passport.selfieDocument {
|
||||
result.append(selfie)
|
||||
}
|
||||
if let fontSide = passport.frontSideDocument {
|
||||
result.append(fontSide)
|
||||
if let frontSide = passport.frontSideDocument {
|
||||
result.append(frontSide)
|
||||
}
|
||||
result.append(contentsOf: passport.translations)
|
||||
return result
|
||||
case let .internalPassport(passport):
|
||||
var result = passport.verificationDocuments
|
||||
if let selfie = passport.selfieDocument {
|
||||
result.append(selfie)
|
||||
}
|
||||
if let fontSide = passport.frontSideDocument {
|
||||
result.append(fontSide)
|
||||
if let frontSide = passport.frontSideDocument {
|
||||
result.append(frontSide)
|
||||
}
|
||||
result.append(contentsOf: passport.translations)
|
||||
return result
|
||||
case let .driversLicense(driversLicense):
|
||||
var result = driversLicense.verificationDocuments
|
||||
if let selfie = driversLicense.selfieDocument {
|
||||
result.append(selfie)
|
||||
}
|
||||
if let fontSide = driversLicense.frontSideDocument {
|
||||
result.append(fontSide)
|
||||
if let frontSide = driversLicense.frontSideDocument {
|
||||
result.append(frontSide)
|
||||
}
|
||||
if let backSide = driversLicense.backSideDocument {
|
||||
result.append(backSide)
|
||||
}
|
||||
result.append(contentsOf: driversLicense.translations)
|
||||
return result
|
||||
case let .idCard(idCard):
|
||||
var result = idCard.verificationDocuments
|
||||
if let selfie = idCard.selfieDocument {
|
||||
result.append(selfie)
|
||||
}
|
||||
if let fontSide = idCard.frontSideDocument {
|
||||
result.append(fontSide)
|
||||
if let frontSide = idCard.frontSideDocument {
|
||||
result.append(frontSide)
|
||||
}
|
||||
if let backSide = idCard.backSideDocument {
|
||||
result.append(backSide)
|
||||
}
|
||||
result.append(contentsOf: idCard.translations)
|
||||
return result
|
||||
case let .passportRegistration(passportRegistration):
|
||||
return passportRegistration.verificationDocuments
|
||||
return passportRegistration.verificationDocuments + passportRegistration.translations
|
||||
case let .temporaryRegistration(passportRegistration):
|
||||
return passportRegistration.verificationDocuments
|
||||
return passportRegistration.verificationDocuments + passportRegistration.translations
|
||||
case let .bankStatement(bankStatement):
|
||||
return bankStatement.verificationDocuments
|
||||
return bankStatement.verificationDocuments + bankStatement.translations
|
||||
case let .utilityBill(utilityBill):
|
||||
return utilityBill.verificationDocuments
|
||||
return utilityBill.verificationDocuments + utilityBill.translations
|
||||
case let .rentalAgreement(rentalAgreement):
|
||||
return rentalAgreement.verificationDocuments
|
||||
return rentalAgreement.verificationDocuments + rentalAgreement.translations
|
||||
default:
|
||||
return []
|
||||
}
|
||||
|
||||
@ -224,7 +224,9 @@ func fetchAndUpdateCachedPeerData(peerId: PeerId, network: Network, postbox: Pos
|
||||
}
|
||||
|
||||
switch fullChat {
|
||||
case let .channelFull(flags, _, about, participantsCount, adminsCount, kickedCount, bannedCount, _, _, _, _, _, apiExportedInvite, apiBotInfos, migratedFromChatId, migratedFromMaxId, pinnedMsgId, stickerSet, minAvailableMsgId):
|
||||
// case channelFull(flags: Int32, id: Int32, about: String, participantsCount: Int32?, adminsCount: Int32?, kickedCount: Int32?, bannedCount: Int32?, readInboxMaxId: Int32, readOutboxMaxId: Int32, unreadCount: Int32, chatPhoto: Api.Photo, notifySettings: Api.PeerNotifySettings, exportedInvite: Api.ExportedChatInvite, botInfo: [Api.BotInfo], migratedFromChatId: Int32?, migratedFromMaxId: Int32?, pinnedMsgId: Int32?, stickerset: Api.StickerSet?, availableMinId: Int32?)
|
||||
|
||||
case let .channelFull(flags, _, about, participantsCount, adminsCount, kickedCount, bannedCount, apiReadInboxMaxId, apiReadOutboxMaxId, apiUnreadCount, _, _, apiExportedInvite, apiBotInfos, migratedFromChatId, migratedFromMaxId, pinnedMsgId, stickerSet, minAvailableMsgId):
|
||||
var channelFlags = CachedChannelFlags()
|
||||
if (flags & (1 << 3)) != 0 {
|
||||
channelFlags.insert(.canDisplayParticipants)
|
||||
@ -288,6 +290,22 @@ func fetchAndUpdateCachedPeerData(peerId: PeerId, network: Network, postbox: Pos
|
||||
|
||||
transaction.updatePeerPresences(peerPresences)
|
||||
|
||||
|
||||
// let readState = transaction.getReadState(peerId)
|
||||
//
|
||||
// let hasReadState: Bool = false//readState?.hasNamespace(Namespaces.Message.Cloud) ?? false
|
||||
//
|
||||
// if !hasReadState {
|
||||
// var readStates: [PeerId: [MessageId.Namespace: PeerReadState]] = [:]
|
||||
// if readStates[peerId] == nil {
|
||||
// readStates[peerId] = [:]
|
||||
// }
|
||||
// readStates[peerId]![Namespaces.Message.Cloud] = .idBased(maxIncomingReadId: apiReadInboxMaxId, maxOutgoingReadId: apiReadOutboxMaxId, maxKnownId: readState?.maxKnownId ?? 0, count: apiUnreadCount, markedUnread: readState?.markedUnread ?? false)
|
||||
// transaction.resetIncomingReadStates(readStates)
|
||||
// }
|
||||
//
|
||||
|
||||
|
||||
let stickerPack: StickerPackCollectionInfo? = stickerSet.flatMap { apiSet -> StickerPackCollectionInfo in
|
||||
let namespace: ItemCollectionId.Namespace
|
||||
switch apiSet {
|
||||
|
||||
@ -12,7 +12,6 @@ import Foundation
|
||||
public enum SecureIdPreparePhoneVerificationError {
|
||||
case generic
|
||||
case flood
|
||||
case occupied
|
||||
}
|
||||
|
||||
public struct SecureIdPreparePhoneVerificationPayload {
|
||||
@ -28,8 +27,6 @@ public func secureIdPreparePhoneVerification(network: Network, value: SecureIdPh
|
||||
|> mapError { error -> SecureIdPreparePhoneVerificationError in
|
||||
if error.errorDescription.hasPrefix("FLOOD_WAIT") {
|
||||
return .flood
|
||||
} else if error.errorDescription == "PHONE_NUMBER_OCCUPIED" {
|
||||
return .occupied
|
||||
}
|
||||
return .generic
|
||||
}
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user