mirror of
https://github.com/Swiftgram/Telegram-iOS.git
synced 2025-12-23 22:55:00 +00:00
Update API [skip ci]
This commit is contained in:
@@ -59,6 +59,15 @@ public struct BotPaymentInvoice : Equatable {
|
||||
public let prices: [BotPaymentPrice]
|
||||
public let tip: Tip?
|
||||
public let termsInfo: RecurrentInfo?
|
||||
|
||||
public init(isTest: Bool, requestedFields: BotPaymentInvoiceFields, currency: String, prices: [BotPaymentPrice], tip: Tip?, termsInfo: RecurrentInfo?) {
|
||||
self.isTest = isTest
|
||||
self.requestedFields = requestedFields
|
||||
self.currency = currency
|
||||
self.prices = prices
|
||||
self.tip = tip
|
||||
self.termsInfo = termsInfo
|
||||
}
|
||||
}
|
||||
|
||||
public struct BotPaymentNativeProvider : Equatable {
|
||||
@@ -125,6 +134,20 @@ public struct BotPaymentForm : Equatable {
|
||||
public let savedInfo: BotPaymentRequestedInfo?
|
||||
public let savedCredentials: [BotPaymentSavedCredentials]
|
||||
public let additionalPaymentMethods: [BotPaymentMethod]
|
||||
|
||||
public init(id: Int64, canSaveCredentials: Bool, passwordMissing: Bool, invoice: BotPaymentInvoice, paymentBotId: PeerId, providerId: PeerId?, url: String?, nativeProvider: BotPaymentNativeProvider?, savedInfo: BotPaymentRequestedInfo?, savedCredentials: [BotPaymentSavedCredentials], additionalPaymentMethods: [BotPaymentMethod]) {
|
||||
self.id = id
|
||||
self.canSaveCredentials = canSaveCredentials
|
||||
self.passwordMissing = passwordMissing
|
||||
self.invoice = invoice
|
||||
self.paymentBotId = paymentBotId
|
||||
self.providerId = providerId
|
||||
self.url = url
|
||||
self.nativeProvider = nativeProvider
|
||||
self.savedInfo = savedInfo
|
||||
self.savedCredentials = savedCredentials
|
||||
self.additionalPaymentMethods = additionalPaymentMethods
|
||||
}
|
||||
}
|
||||
|
||||
public struct BotPaymentMethod: Equatable {
|
||||
|
||||
@@ -199,7 +199,7 @@ private final class StarsContextImpl {
|
||||
return
|
||||
}
|
||||
var transactions = state.transactions
|
||||
transactions.insert(.init(flags: [.isLocal], id: "\(arc4random())", count: balance, date: Int32(Date().timeIntervalSince1970), peer: .appStore, title: nil, description: nil, photo: nil), at: 0)
|
||||
transactions.insert(.init(flags: [.isLocal], id: "\(arc4random())", count: balance, date: Int32(Date().timeIntervalSince1970), peer: .appStore, title: nil, description: nil, photo: nil, transactionDate: nil, transactionUrl: nil), at: 0)
|
||||
|
||||
self.updateState(StarsContext.State(flags: [.isPendingBalance], balance: state.balance + balance, transactions: transactions, canLoadMore: state.canLoadMore, isLoading: state.isLoading))
|
||||
}
|
||||
@@ -238,7 +238,7 @@ private final class StarsContextImpl {
|
||||
private extension StarsContext.State.Transaction {
|
||||
init?(apiTransaction: Api.StarsTransaction, transaction: Transaction) {
|
||||
switch apiTransaction {
|
||||
case let .starsTransaction(apiFlags, id, stars, date, transactionPeer, title, description, photo):
|
||||
case let .starsTransaction(apiFlags, id, stars, date, transactionPeer, title, description, photo, transactionDate, transactionUrl):
|
||||
let parsedPeer: StarsContext.State.Transaction.Peer
|
||||
switch transactionPeer {
|
||||
case .starsTransactionPeerAppStore:
|
||||
@@ -262,7 +262,7 @@ private extension StarsContext.State.Transaction {
|
||||
if (apiFlags & (1 << 3)) != 0 {
|
||||
flags.insert(.isRefund)
|
||||
}
|
||||
self.init(flags: flags, id: id, count: stars, date: date, peer: parsedPeer, title: title, description: description, photo: photo.flatMap(TelegramMediaWebFile.init))
|
||||
self.init(flags: flags, id: id, count: stars, date: date, peer: parsedPeer, title: title, description: description, photo: photo.flatMap(TelegramMediaWebFile.init), transactionDate: transactionDate, transactionUrl: transactionUrl)
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -279,6 +279,7 @@ public final class StarsContext {
|
||||
|
||||
public static let isRefund = Flags(rawValue: 1 << 0)
|
||||
public static let isLocal = Flags(rawValue: 1 << 1)
|
||||
public static let isPending = Flags(rawValue: 1 << 2)
|
||||
}
|
||||
|
||||
public enum Peer: Equatable {
|
||||
@@ -298,6 +299,8 @@ public final class StarsContext {
|
||||
public let title: String?
|
||||
public let description: String?
|
||||
public let photo: TelegramMediaWebFile?
|
||||
public let transactionDate: Int32?
|
||||
public let transactionUrl: String?
|
||||
|
||||
public init(
|
||||
flags: Flags,
|
||||
@@ -307,7 +310,9 @@ public final class StarsContext {
|
||||
peer: Peer,
|
||||
title: String?,
|
||||
description: String?,
|
||||
photo: TelegramMediaWebFile?
|
||||
photo: TelegramMediaWebFile?,
|
||||
transactionDate: Int32?,
|
||||
transactionUrl: String?
|
||||
) {
|
||||
self.flags = flags
|
||||
self.id = id
|
||||
@@ -317,6 +322,8 @@ public final class StarsContext {
|
||||
self.title = title
|
||||
self.description = description
|
||||
self.photo = photo
|
||||
self.transactionDate = transactionDate
|
||||
self.transactionUrl = transactionUrl
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -823,6 +823,14 @@ public extension TelegramEngine {
|
||||
return _internal_requestChannelRevenueWithdrawalUrl(account: self.account, peerId: peerId, password: password)
|
||||
}
|
||||
|
||||
public func checkStarsRevenueWithdrawalAvailability() -> Signal<Never, RequestStarsRevenueWithdrawalError> {
|
||||
return _internal_checkStarsRevenueWithdrawalAvailability(account: self.account)
|
||||
}
|
||||
|
||||
public func requestStarsRevenueWithdrawalUrl(peerId: EnginePeer.Id, amount: Int64, password: String) -> Signal<String, RequestStarsRevenueWithdrawalError> {
|
||||
return _internal_requestStarsRevenueWithdrawalUrl(account: self.account, peerId: peerId, amount: amount, password: password)
|
||||
}
|
||||
|
||||
public func getChatListPeers(filterPredicate: ChatListFilterPredicate) -> Signal<[EnginePeer], NoError> {
|
||||
return self.account.postbox.transaction { transaction -> [EnginePeer] in
|
||||
return transaction.getChatListPeers(groupId: .root, filterPredicate: filterPredicate, additionalFilter: nil).map(EnginePeer.init)
|
||||
|
||||
Reference in New Issue
Block a user