mirror of
https://github.com/Swiftgram/Telegram-iOS.git
synced 2025-12-04 21:41:45 +00:00
Merge branch 'master' of gitlab.com:peter-iakovlev/telegram-ios
This commit is contained in:
commit
efaa2a71af
@ -104,9 +104,8 @@
|
|||||||
"PUSH_MESSAGES_1" = "%1$@|sent you a message";
|
"PUSH_MESSAGES_1" = "%1$@|sent you a message";
|
||||||
"PUSH_MESSAGES_any" = "%1$@|sent you %2$d messages";
|
"PUSH_MESSAGES_any" = "%1$@|sent you %2$d messages";
|
||||||
"PUSH_ALBUM" = "%1$@|sent you an album";
|
"PUSH_ALBUM" = "%1$@|sent you an album";
|
||||||
"PUSH_MESSAGE_DOCS" = "%1$@|sent you %2$d files";
|
"PUSH_MESSAGE_FILES_1" = "%1$@|sent you a file";
|
||||||
"PUSH_MESSAGE_DOCS_1" = "%1$@|sent you a file";
|
"PUSH_MESSAGE_FILES_any" = "%1$@|sent you %2$d files";
|
||||||
"PUSH_MESSAGE_DOCS_any" = "%1$@|sent you %2$d files";
|
|
||||||
|
|
||||||
|
|
||||||
"PUSH_CHANNEL_MESSAGE_TEXT" = "%1$@|%2$@";
|
"PUSH_CHANNEL_MESSAGE_TEXT" = "%1$@|%2$@";
|
||||||
|
|||||||
@ -564,8 +564,19 @@ final class BotCheckoutControllerNode: ItemListControllerNode, PKPaymentAuthoriz
|
|||||||
}, ensureTipInputVisible: {
|
}, ensureTipInputVisible: {
|
||||||
ensureTipInputVisibleImpl?()
|
ensureTipInputVisibleImpl?()
|
||||||
})
|
})
|
||||||
|
|
||||||
|
let paymentBotPeer = paymentFormAndInfo.get()
|
||||||
|
|> map { paymentFormAndInfo -> PeerId? in
|
||||||
|
return paymentFormAndInfo?.0.paymentBotId
|
||||||
|
}
|
||||||
|
|> distinctUntilChanged
|
||||||
|
|> mapToSignal { peerId -> Signal<Peer?, NoError> in
|
||||||
|
return context.account.postbox.transaction { transaction -> Peer? in
|
||||||
|
return peerId.flatMap(transaction.getPeer)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
let signal: Signal<(ItemListPresentationData, (ItemListNodeState, Any)), NoError> = combineLatest(context.sharedContext.presentationData, self.state.get(), paymentFormAndInfo.get(), context.account.postbox.loadedPeerWithId(messageId.peerId))
|
let signal: Signal<(ItemListPresentationData, (ItemListNodeState, Any)), NoError> = combineLatest(queue: .mainQueue(), context.sharedContext.presentationData, self.state.get(), paymentFormAndInfo.get(), paymentBotPeer)
|
||||||
|> map { presentationData, state, paymentFormAndInfo, botPeer -> (ItemListPresentationData, (ItemListNodeState, Any)) in
|
|> map { presentationData, state, paymentFormAndInfo, botPeer -> (ItemListPresentationData, (ItemListNodeState, Any)) in
|
||||||
let nodeState = ItemListNodeState(presentationData: ItemListPresentationData(presentationData), entries: botCheckoutControllerEntries(presentationData: presentationData, state: state, invoice: invoice, paymentForm: paymentFormAndInfo?.0, formInfo: paymentFormAndInfo?.1, validatedFormInfo: paymentFormAndInfo?.2, currentShippingOptionId: paymentFormAndInfo?.3, currentPaymentMethod: paymentFormAndInfo?.4, currentTip: paymentFormAndInfo?.5, botPeer: botPeer), style: .blocks, focusItemTag: nil, emptyStateItem: nil, animateChanges: false)
|
let nodeState = ItemListNodeState(presentationData: ItemListPresentationData(presentationData), entries: botCheckoutControllerEntries(presentationData: presentationData, state: state, invoice: invoice, paymentForm: paymentFormAndInfo?.0, formInfo: paymentFormAndInfo?.1, validatedFormInfo: paymentFormAndInfo?.2, currentShippingOptionId: paymentFormAndInfo?.3, currentPaymentMethod: paymentFormAndInfo?.4, currentTip: paymentFormAndInfo?.5, botPeer: botPeer), style: .blocks, focusItemTag: nil, emptyStateItem: nil, animateChanges: false)
|
||||||
|
|
||||||
@ -1184,7 +1195,7 @@ final class BotCheckoutControllerNode: ItemListControllerNode, PKPaymentAuthoriz
|
|||||||
}
|
}
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
let _ = (combineLatest(ApplicationSpecificNotice.getBotPaymentLiability(accountManager: self.context.sharedContext.accountManager, peerId: self.messageId.peerId), botPeer, self.context.account.postbox.loadedPeerWithId(paymentForm.providerId))
|
let _ = (combineLatest(ApplicationSpecificNotice.getBotPaymentLiability(accountManager: self.context.sharedContext.accountManager, peerId: paymentForm.paymentBotId), botPeer, self.context.account.postbox.loadedPeerWithId(paymentForm.providerId))
|
||||||
|> deliverOnMainQueue).start(next: { [weak self] value, botPeer, providerPeer in
|
|> deliverOnMainQueue).start(next: { [weak self] value, botPeer, providerPeer in
|
||||||
if let strongSelf = self, let botPeer = botPeer {
|
if let strongSelf = self, let botPeer = botPeer {
|
||||||
if value {
|
if value {
|
||||||
|
|||||||
@ -348,7 +348,7 @@ final class MutableGlobalMessageTagsView: MutablePostboxView {
|
|||||||
}
|
}
|
||||||
|
|
||||||
if let later = self.later {
|
if let later = self.later {
|
||||||
addedEntries += postbox.messageHistoryTable.laterEntries(globalTagMask: self.globalTag, index: later.predecessor(), count: self.count).map { entry -> InternalGlobalMessageTagsEntry in
|
addedEntries += postbox.messageHistoryTable.laterEntries(globalTagMask: self.globalTag, index: later.globalPredecessor(), count: self.count).map { entry -> InternalGlobalMessageTagsEntry in
|
||||||
switch entry {
|
switch entry {
|
||||||
case let .message(message):
|
case let .message(message):
|
||||||
return .intermediateMessage(message)
|
return .intermediateMessage(message)
|
||||||
@ -358,7 +358,7 @@ final class MutableGlobalMessageTagsView: MutablePostboxView {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
if let earlier = self.earlier {
|
if let earlier = self.earlier {
|
||||||
addedEntries += postbox.messageHistoryTable.earlierEntries(globalTagMask: self.globalTag, index: earlier.successor(), count: self.count).map { entry -> InternalGlobalMessageTagsEntry in
|
addedEntries += postbox.messageHistoryTable.earlierEntries(globalTagMask: self.globalTag, index: earlier.globalSuccessor(), count: self.count).map { entry -> InternalGlobalMessageTagsEntry in
|
||||||
switch entry {
|
switch entry {
|
||||||
case let .message(message):
|
case let .message(message):
|
||||||
return .intermediateMessage(message)
|
return .intermediateMessage(message)
|
||||||
|
|||||||
@ -103,12 +103,24 @@ public struct MessageIndex: Comparable, Hashable {
|
|||||||
self.timestamp = timestamp
|
self.timestamp = timestamp
|
||||||
}
|
}
|
||||||
|
|
||||||
public func predecessor() -> MessageIndex {
|
public func globalPredecessor() -> MessageIndex {
|
||||||
let previousPeerId = self.id.peerId.predecessor
|
let previousPeerId = self.id.peerId.predecessor
|
||||||
if previousPeerId != self.id.peerId {
|
if previousPeerId != self.id.peerId {
|
||||||
return MessageIndex(id: MessageId(peerId: previousPeerId, namespace: self.id.namespace, id: self.id.id), timestamp: self.timestamp)
|
return MessageIndex(id: MessageId(peerId: previousPeerId, namespace: self.id.namespace, id: self.id.id), timestamp: self.timestamp)
|
||||||
} else if self.id.id != 0 {
|
} else if self.id.id != 0 {
|
||||||
return MessageIndex(id: MessageId(peerId: self.id.peerId, namespace: self.id.namespace, id: self.id.id), timestamp: self.timestamp)
|
return MessageIndex(id: MessageId(peerId: self.id.peerId, namespace: self.id.namespace, id: self.id.id - 1), timestamp: self.timestamp)
|
||||||
|
} else if self.id.namespace != 0 {
|
||||||
|
return MessageIndex(id: MessageId(peerId: self.id.peerId, namespace: self.id.namespace - 1, id: Int32.max - 1), timestamp: self.timestamp)
|
||||||
|
} else if self.timestamp != 0 {
|
||||||
|
return MessageIndex(id: MessageId(peerId: self.id.peerId, namespace: Int32(Int8.max) - 1, id: Int32.max - 1), timestamp: self.timestamp - 1)
|
||||||
|
} else {
|
||||||
|
return self
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public func peerLocalPredecessor() -> MessageIndex {
|
||||||
|
if self.id.id != 0 {
|
||||||
|
return MessageIndex(id: MessageId(peerId: self.id.peerId, namespace: self.id.namespace, id: self.id.id - 1), timestamp: self.timestamp)
|
||||||
} else if self.id.namespace != 0 {
|
} else if self.id.namespace != 0 {
|
||||||
return MessageIndex(id: MessageId(peerId: self.id.peerId, namespace: self.id.namespace - 1, id: Int32.max - 1), timestamp: self.timestamp)
|
return MessageIndex(id: MessageId(peerId: self.id.peerId, namespace: self.id.namespace - 1, id: Int32.max - 1), timestamp: self.timestamp)
|
||||||
} else if self.timestamp != 0 {
|
} else if self.timestamp != 0 {
|
||||||
@ -118,7 +130,7 @@ public struct MessageIndex: Comparable, Hashable {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public func successor() -> MessageIndex {
|
public func globalSuccessor() -> MessageIndex {
|
||||||
let nextPeerId = self.id.peerId.successor
|
let nextPeerId = self.id.peerId.successor
|
||||||
if nextPeerId != self.id.peerId {
|
if nextPeerId != self.id.peerId {
|
||||||
return MessageIndex(id: MessageId(peerId: nextPeerId, namespace: self.id.namespace, id: self.id.id), timestamp: self.timestamp)
|
return MessageIndex(id: MessageId(peerId: nextPeerId, namespace: self.id.namespace, id: self.id.id), timestamp: self.timestamp)
|
||||||
@ -126,6 +138,10 @@ public struct MessageIndex: Comparable, Hashable {
|
|||||||
return MessageIndex(id: MessageId(peerId: self.id.peerId, namespace: self.id.namespace, id: self.id.id == Int32.max ? self.id.id : (self.id.id + 1)), timestamp: self.timestamp)
|
return MessageIndex(id: MessageId(peerId: self.id.peerId, namespace: self.id.namespace, id: self.id.id == Int32.max ? self.id.id : (self.id.id + 1)), timestamp: self.timestamp)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public func peerLocalSuccessor() -> MessageIndex {
|
||||||
|
return MessageIndex(id: MessageId(peerId: self.id.peerId, namespace: self.id.namespace, id: self.id.id == Int32.max ? self.id.id : (self.id.id + 1)), timestamp: self.timestamp)
|
||||||
|
}
|
||||||
|
|
||||||
public static func absoluteUpperBound() -> MessageIndex {
|
public static func absoluteUpperBound() -> MessageIndex {
|
||||||
return MessageIndex(id: MessageId(peerId: PeerId.max, namespace: Int32(Int8.max), id: Int32.max), timestamp: Int32.max)
|
return MessageIndex(id: MessageId(peerId: PeerId.max, namespace: Int32(Int8.max), id: Int32.max), timestamp: Int32.max)
|
||||||
@ -217,11 +233,11 @@ public struct ChatListIndex: Comparable, Hashable {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public var predecessor: ChatListIndex {
|
public var predecessor: ChatListIndex {
|
||||||
return ChatListIndex(pinningIndex: self.pinningIndex, messageIndex: self.messageIndex.predecessor())
|
return ChatListIndex(pinningIndex: self.pinningIndex, messageIndex: self.messageIndex.globalPredecessor())
|
||||||
}
|
}
|
||||||
|
|
||||||
public var successor: ChatListIndex {
|
public var successor: ChatListIndex {
|
||||||
return ChatListIndex(pinningIndex: self.pinningIndex, messageIndex: self.messageIndex.successor())
|
return ChatListIndex(pinningIndex: self.pinningIndex, messageIndex: self.messageIndex.globalSuccessor())
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -315,7 +315,7 @@ final class MessageHistoryReadStateTable: Table {
|
|||||||
readPastTopIndex = true
|
readPastTopIndex = true
|
||||||
}
|
}
|
||||||
if maxIncomingReadIndex < messageIndex || markedUnread || readPastTopIndex {
|
if maxIncomingReadIndex < messageIndex || markedUnread || readPastTopIndex {
|
||||||
let (realDeltaCount, holes, messageIds) = incomingStatsInRange(maxIncomingReadIndex.successor(), messageIndex)
|
let (realDeltaCount, holes, messageIds) = incomingStatsInRange(maxIncomingReadIndex.peerLocalSuccessor(), messageIndex)
|
||||||
var deltaCount = realDeltaCount
|
var deltaCount = realDeltaCount
|
||||||
if readPastTopIndex {
|
if readPastTopIndex {
|
||||||
deltaCount = max(Int(count), deltaCount)
|
deltaCount = max(Int(count), deltaCount)
|
||||||
@ -366,7 +366,7 @@ final class MessageHistoryReadStateTable: Table {
|
|||||||
break
|
break
|
||||||
case let .indexBased(maxIncomingReadIndex, maxOutgoingReadIndex, count, markedUnread):
|
case let .indexBased(maxIncomingReadIndex, maxOutgoingReadIndex, count, markedUnread):
|
||||||
if maxOutgoingReadIndex < messageIndex {
|
if maxOutgoingReadIndex < messageIndex {
|
||||||
let messageIds: [MessageId] = outgoingIndexStatsInRange(maxOutgoingReadIndex.successor(), messageIndex)
|
let messageIds: [MessageId] = outgoingIndexStatsInRange(maxOutgoingReadIndex.peerLocalSuccessor(), messageIndex)
|
||||||
|
|
||||||
self.markReadStatesAsUpdated(messageIndex.id.peerId, namespaces: states.namespaces)
|
self.markReadStatesAsUpdated(messageIndex.id.peerId, namespaces: states.namespaces)
|
||||||
states.namespaces[messageIndex.id.namespace] = .indexBased(maxIncomingReadIndex: maxIncomingReadIndex, maxOutgoingReadIndex: messageIndex, count: count, markedUnread: markedUnread)
|
states.namespaces[messageIndex.id.namespace] = .indexBased(maxIncomingReadIndex: maxIncomingReadIndex, maxOutgoingReadIndex: messageIndex, count: count, markedUnread: markedUnread)
|
||||||
|
|||||||
@ -1053,7 +1053,7 @@ public final class MessageHistoryView {
|
|||||||
index = 0
|
index = 0
|
||||||
for entry in entries {
|
for entry in entries {
|
||||||
if entry.index.id.peerId == peerId && entry.index.id.namespace == namespace {
|
if entry.index.id.peerId == peerId && entry.index.id.namespace == namespace {
|
||||||
maxNamespaceIndex = entry.index.predecessor()
|
maxNamespaceIndex = entry.index.peerLocalPredecessor()
|
||||||
break
|
break
|
||||||
}
|
}
|
||||||
index += 1
|
index += 1
|
||||||
@ -1109,7 +1109,7 @@ public final class MessageHistoryView {
|
|||||||
index = 0
|
index = 0
|
||||||
for entry in entries {
|
for entry in entries {
|
||||||
if entry.index.id.peerId == peerId && entry.index.id.namespace == namespace {
|
if entry.index.id.peerId == peerId && entry.index.id.namespace == namespace {
|
||||||
maxNamespaceIndex = entry.index.predecessor()
|
maxNamespaceIndex = entry.index.peerLocalPredecessor()
|
||||||
break
|
break
|
||||||
}
|
}
|
||||||
index += 1
|
index += 1
|
||||||
|
|||||||
@ -468,11 +468,11 @@ private func sampleHoleRanges(input: MessageHistoryInput, orderedEntriesBySpace:
|
|||||||
if items.higherThanAnchor.count == 0 {
|
if items.higherThanAnchor.count == 0 {
|
||||||
clipRanges.append(MessageIndex.absoluteLowerBound() ... MessageIndex.absoluteUpperBound())
|
clipRanges.append(MessageIndex.absoluteLowerBound() ... MessageIndex.absoluteUpperBound())
|
||||||
} else {
|
} else {
|
||||||
let clipIndex = items.higherThanAnchor[0].index.predecessor()
|
let clipIndex = items.higherThanAnchor[0].index.peerLocalPredecessor()
|
||||||
clipRanges.append(MessageIndex.absoluteLowerBound() ... clipIndex)
|
clipRanges.append(MessageIndex.absoluteLowerBound() ... clipIndex)
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
let clipIndex = items.lowerOrAtAnchor[0].index.predecessor()
|
let clipIndex = items.lowerOrAtAnchor[0].index.peerLocalPredecessor()
|
||||||
clipRanges.append(MessageIndex.absoluteLowerBound() ... clipIndex)
|
clipRanges.append(MessageIndex.absoluteLowerBound() ... clipIndex)
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
@ -480,7 +480,7 @@ private func sampleHoleRanges(input: MessageHistoryInput, orderedEntriesBySpace:
|
|||||||
if items.higherThanAnchor.count == 0 {
|
if items.higherThanAnchor.count == 0 {
|
||||||
clipRanges.append(MessageIndex.absoluteLowerBound() ... MessageIndex.absoluteUpperBound())
|
clipRanges.append(MessageIndex.absoluteLowerBound() ... MessageIndex.absoluteUpperBound())
|
||||||
} else {
|
} else {
|
||||||
let clipIndex = items.higherThanAnchor[0].index.predecessor()
|
let clipIndex = items.higherThanAnchor[0].index.peerLocalPredecessor()
|
||||||
clipRanges.append(MessageIndex.absoluteLowerBound() ... clipIndex)
|
clipRanges.append(MessageIndex.absoluteLowerBound() ... clipIndex)
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
@ -488,7 +488,7 @@ private func sampleHoleRanges(input: MessageHistoryInput, orderedEntriesBySpace:
|
|||||||
if indices.contains(Int(items.lowerOrAtAnchor[i + 1].index.id.id)) {
|
if indices.contains(Int(items.lowerOrAtAnchor[i + 1].index.id.id)) {
|
||||||
clipIndex = items.lowerOrAtAnchor[i + 1].index
|
clipIndex = items.lowerOrAtAnchor[i + 1].index
|
||||||
} else {
|
} else {
|
||||||
clipIndex = items.lowerOrAtAnchor[i + 1].index.predecessor()
|
clipIndex = items.lowerOrAtAnchor[i + 1].index.peerLocalPredecessor()
|
||||||
}
|
}
|
||||||
clipRanges.append(MessageIndex.absoluteLowerBound() ... clipIndex)
|
clipRanges.append(MessageIndex.absoluteLowerBound() ... clipIndex)
|
||||||
}
|
}
|
||||||
@ -536,11 +536,11 @@ private func sampleHoleRanges(input: MessageHistoryInput, orderedEntriesBySpace:
|
|||||||
if items.lowerOrAtAnchor.count == 0 {
|
if items.lowerOrAtAnchor.count == 0 {
|
||||||
clipRanges.append(MessageIndex.absoluteLowerBound() ... MessageIndex.absoluteUpperBound())
|
clipRanges.append(MessageIndex.absoluteLowerBound() ... MessageIndex.absoluteUpperBound())
|
||||||
} else {
|
} else {
|
||||||
let clipIndex = items.lowerOrAtAnchor[items.lowerOrAtAnchor.count - 1].index.successor()
|
let clipIndex = items.lowerOrAtAnchor[items.lowerOrAtAnchor.count - 1].index.peerLocalSuccessor()
|
||||||
clipRanges.append(clipIndex ... MessageIndex.absoluteUpperBound())
|
clipRanges.append(clipIndex ... MessageIndex.absoluteUpperBound())
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
let clipIndex = items.higherThanAnchor[items.higherThanAnchor.count - 1].index.successor()
|
let clipIndex = items.higherThanAnchor[items.higherThanAnchor.count - 1].index.peerLocalSuccessor()
|
||||||
clipRanges.append(clipIndex ... MessageIndex.absoluteUpperBound())
|
clipRanges.append(clipIndex ... MessageIndex.absoluteUpperBound())
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
@ -548,7 +548,7 @@ private func sampleHoleRanges(input: MessageHistoryInput, orderedEntriesBySpace:
|
|||||||
if items.lowerOrAtAnchor.count == 0 {
|
if items.lowerOrAtAnchor.count == 0 {
|
||||||
clipRanges.append(MessageIndex.absoluteLowerBound() ... MessageIndex.absoluteUpperBound())
|
clipRanges.append(MessageIndex.absoluteLowerBound() ... MessageIndex.absoluteUpperBound())
|
||||||
} else {
|
} else {
|
||||||
let clipIndex = items.lowerOrAtAnchor[items.lowerOrAtAnchor.count - 1].index.successor()
|
let clipIndex = items.lowerOrAtAnchor[items.lowerOrAtAnchor.count - 1].index.peerLocalSuccessor()
|
||||||
clipRanges.append(clipIndex ... MessageIndex.absoluteUpperBound())
|
clipRanges.append(clipIndex ... MessageIndex.absoluteUpperBound())
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
@ -556,7 +556,7 @@ private func sampleHoleRanges(input: MessageHistoryInput, orderedEntriesBySpace:
|
|||||||
if indices.contains(Int(items.higherThanAnchor[i - 1].index.id.id)) {
|
if indices.contains(Int(items.higherThanAnchor[i - 1].index.id.id)) {
|
||||||
clipIndex = items.higherThanAnchor[i - 1].index
|
clipIndex = items.higherThanAnchor[i - 1].index
|
||||||
} else {
|
} else {
|
||||||
clipIndex = items.higherThanAnchor[i - 1].index.successor()
|
clipIndex = items.higherThanAnchor[i - 1].index.peerLocalSuccessor()
|
||||||
}
|
}
|
||||||
clipRanges.append(clipIndex ... MessageIndex.absoluteUpperBound())
|
clipRanges.append(clipIndex ... MessageIndex.absoluteUpperBound())
|
||||||
}
|
}
|
||||||
|
|||||||
@ -434,7 +434,7 @@ public func dataPrivacyController(context: AccountContext) -> ViewController {
|
|||||||
return state
|
return state
|
||||||
}
|
}
|
||||||
let presentationData = context.sharedContext.currentPresentationData.with { $0 }
|
let presentationData = context.sharedContext.currentPresentationData.with { $0 }
|
||||||
presentControllerImpl?(UndoOverlayController(presentationData: presentationData, content: .succeed(text: presentationData.strings.Privacy_ContactsSync_ContactsDeleted), elevatedLayout: false, action: { _ in return false }))
|
presentControllerImpl?(UndoOverlayController(presentationData: presentationData, content: .succeed(text: presentationData.strings.Privacy_ContactsReset_ContactsDeleted), elevatedLayout: false, action: { _ in return false }))
|
||||||
}))
|
}))
|
||||||
}), TextAlertAction(type: .defaultAction, title: presentationData.strings.Common_Cancel, action: {})]))
|
}), TextAlertAction(type: .defaultAction, title: presentationData.strings.Common_Cancel, action: {})]))
|
||||||
}
|
}
|
||||||
|
|||||||
@ -106,6 +106,7 @@ public struct BotPaymentForm : Equatable {
|
|||||||
public let canSaveCredentials: Bool
|
public let canSaveCredentials: Bool
|
||||||
public let passwordMissing: Bool
|
public let passwordMissing: Bool
|
||||||
public let invoice: BotPaymentInvoice
|
public let invoice: BotPaymentInvoice
|
||||||
|
public let paymentBotId: PeerId
|
||||||
public let providerId: PeerId
|
public let providerId: PeerId
|
||||||
public let url: String
|
public let url: String
|
||||||
public let nativeProvider: BotPaymentNativeProvider?
|
public let nativeProvider: BotPaymentNativeProvider?
|
||||||
@ -198,7 +199,7 @@ public func fetchBotPaymentForm(postbox: Postbox, network: Network, messageId: M
|
|||||||
|> mapToSignal { result -> Signal<BotPaymentForm, BotPaymentFormRequestError> in
|
|> mapToSignal { result -> Signal<BotPaymentForm, BotPaymentFormRequestError> in
|
||||||
return postbox.transaction { transaction -> BotPaymentForm in
|
return postbox.transaction { transaction -> BotPaymentForm in
|
||||||
switch result {
|
switch result {
|
||||||
case let .paymentForm(flags, id, _, invoice, providerId, url, nativeProvider, nativeParams, savedInfo, savedCredentials, apiUsers):
|
case let .paymentForm(flags, id, botId, invoice, providerId, url, nativeProvider, nativeParams, savedInfo, savedCredentials, apiUsers):
|
||||||
var peers: [Peer] = []
|
var peers: [Peer] = []
|
||||||
for user in apiUsers {
|
for user in apiUsers {
|
||||||
let parsed = TelegramUser(user: user)
|
let parsed = TelegramUser(user: user)
|
||||||
@ -224,7 +225,7 @@ public func fetchBotPaymentForm(postbox: Postbox, network: Network, messageId: M
|
|||||||
parsedSavedCredentials = .card(id: id, title: title)
|
parsedSavedCredentials = .card(id: id, title: title)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return BotPaymentForm(id: id, canSaveCredentials: (flags & (1 << 2)) != 0, passwordMissing: (flags & (1 << 3)) != 0, invoice: parsedInvoice, providerId: PeerId(namespace: Namespaces.Peer.CloudUser, id: PeerId.Id._internalFromInt32Value(providerId)), url: url, nativeProvider: parsedNativeProvider, savedInfo: parsedSavedInfo, savedCredentials: parsedSavedCredentials)
|
return BotPaymentForm(id: id, canSaveCredentials: (flags & (1 << 2)) != 0, passwordMissing: (flags & (1 << 3)) != 0, invoice: parsedInvoice, paymentBotId: PeerId(namespace: Namespaces.Peer.CloudUser, id: PeerId.Id._internalFromInt32Value(botId)), providerId: PeerId(namespace: Namespaces.Peer.CloudUser, id: PeerId.Id._internalFromInt32Value(providerId)), url: url, nativeProvider: parsedNativeProvider, savedInfo: parsedSavedInfo, savedCredentials: parsedSavedCredentials)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|> mapError { _ -> BotPaymentFormRequestError in }
|
|> mapError { _ -> BotPaymentFormRequestError in }
|
||||||
@ -429,7 +430,7 @@ public struct BotPaymentReceipt : Equatable {
|
|||||||
public let credentialsTitle: String
|
public let credentialsTitle: String
|
||||||
public let invoiceMedia: TelegramMediaInvoice
|
public let invoiceMedia: TelegramMediaInvoice
|
||||||
public let tipAmount: Int64?
|
public let tipAmount: Int64?
|
||||||
|
public let botPaymentId: PeerId
|
||||||
public static func ==(lhs: BotPaymentReceipt, rhs: BotPaymentReceipt) -> Bool {
|
public static func ==(lhs: BotPaymentReceipt, rhs: BotPaymentReceipt) -> Bool {
|
||||||
if lhs.invoice != rhs.invoice {
|
if lhs.invoice != rhs.invoice {
|
||||||
return false
|
return false
|
||||||
@ -449,6 +450,9 @@ public struct BotPaymentReceipt : Equatable {
|
|||||||
if lhs.tipAmount != rhs.tipAmount {
|
if lhs.tipAmount != rhs.tipAmount {
|
||||||
return false
|
return false
|
||||||
}
|
}
|
||||||
|
if lhs.botPaymentId != rhs.botPaymentId {
|
||||||
|
return false
|
||||||
|
}
|
||||||
return true
|
return true
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -515,8 +519,10 @@ public func requestBotPaymentReceipt(account: Account, messageId: MessageId) ->
|
|||||||
startParam: "",
|
startParam: "",
|
||||||
flags: []
|
flags: []
|
||||||
)
|
)
|
||||||
|
|
||||||
|
let botPaymentId = PeerId.init(namespace: Namespaces.Peer.CloudUser, id: PeerId.Id._internalFromInt32Value(botId))
|
||||||
|
|
||||||
return BotPaymentReceipt(invoice: parsedInvoice, info: parsedInfo, shippingOption: shippingOption, credentialsTitle: credentialsTitle, invoiceMedia: invoiceMedia, tipAmount: tipAmount)
|
return BotPaymentReceipt(invoice: parsedInvoice, info: parsedInfo, shippingOption: shippingOption, credentialsTitle: credentialsTitle, invoiceMedia: invoiceMedia, tipAmount: tipAmount, botPaymentId: botPaymentId)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|> castError(RequestBotPaymentReceiptError.self)
|
|> castError(RequestBotPaymentReceiptError.self)
|
||||||
|
|||||||
@ -698,7 +698,7 @@ func fetchCallListHole(network: Network, postbox: Postbox, accountPeerId: PeerId
|
|||||||
|
|
||||||
var updatedIndex: MessageIndex?
|
var updatedIndex: MessageIndex?
|
||||||
if let topIndex = topIndex {
|
if let topIndex = topIndex {
|
||||||
updatedIndex = topIndex.predecessor()
|
updatedIndex = topIndex.globalPredecessor()
|
||||||
}
|
}
|
||||||
|
|
||||||
transaction.replaceGlobalMessageTagsHole(globalTags: [.Calls, .MissedCalls], index: holeIndex, with: updatedIndex, messages: storeMessages)
|
transaction.replaceGlobalMessageTagsHole(globalTags: [.Calls, .MissedCalls], index: holeIndex, with: updatedIndex, messages: storeMessages)
|
||||||
|
|||||||
File diff suppressed because it is too large
Load Diff
Binary file not shown.
@ -341,7 +341,7 @@ final class ChatMessageNotificationItemNode: NotificationItemNode {
|
|||||||
messageText = rawText
|
messageText = rawText
|
||||||
}
|
}
|
||||||
case .file:
|
case .file:
|
||||||
let rawText = presentationData.strings.PUSH_MESSAGE_DOCS(Int32(item.messages.count), peer.displayTitle(strings: item.strings, displayOrder: item.nameDisplayOrder), Int32(item.messages.count))
|
let rawText = presentationData.strings.PUSH_MESSAGE_FILES(Int32(item.messages.count), peer.displayTitle(strings: item.strings, displayOrder: item.nameDisplayOrder), Int32(item.messages.count))
|
||||||
if let index = rawText.firstIndex(of: "|") {
|
if let index = rawText.firstIndex(of: "|") {
|
||||||
title = String(rawText[rawText.startIndex ..< index])
|
title = String(rawText[rawText.startIndex ..< index])
|
||||||
messageText = String(rawText[rawText.index(after: index)...])
|
messageText = String(rawText[rawText.index(after: index)...])
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user