mirror of
https://github.com/Swiftgram/Telegram-iOS.git
synced 2026-02-10 04:56:22 +00:00
Revert forIQTP parameter
This commit is contained in:
@@ -29,7 +29,7 @@ public func sgIqtpQuery(engine: TelegramEngine, query: String, incompleteResults
|
||||
#else
|
||||
SGLogger.shared.log("SGIQTP", "[\(queryId)] Query")
|
||||
#endif
|
||||
return engine.peers.resolvePeerByName(forIQTP: true, name: SG_CONFIG.botUsername, referrer: nil)
|
||||
return engine.peers.resolvePeerByName(name: SG_CONFIG.botUsername, referrer: nil)
|
||||
|> mapToSignal { result -> Signal<EnginePeer?, NoError> in
|
||||
guard case let .result(result) = result else {
|
||||
SGLogger.shared.log("SGIQTP", "[\(queryId)] Failed to resolve peer \(SG_CONFIG.botUsername)")
|
||||
|
||||
@@ -52,7 +52,7 @@ public struct RequestChatContextResultsResult {
|
||||
}
|
||||
}
|
||||
|
||||
func _internal_requestChatContextResults(forIQTP: Bool = false, account: Account, botId: PeerId, peerId: PeerId, query: String, location: Signal<(Double, Double)?, NoError> = .single(nil), offset: String, incompleteResults: Bool = false, staleCachedResults: Bool = false) -> Signal<RequestChatContextResultsResult?, RequestChatContextResultsError> {
|
||||
func _internal_requestChatContextResults(account: Account, botId: PeerId, peerId: PeerId, query: String, location: Signal<(Double, Double)?, NoError> = .single(nil), offset: String, incompleteResults: Bool = false, staleCachedResults: Bool = false) -> Signal<RequestChatContextResultsResult?, RequestChatContextResultsError> {
|
||||
return account.postbox.transaction { transaction -> (bot: Peer, peer: Peer)? in
|
||||
if let bot = transaction.getPeer(botId), let peer = transaction.getPeer(peerId) {
|
||||
return (bot, peer)
|
||||
@@ -77,7 +77,7 @@ func _internal_requestChatContextResults(forIQTP: Bool = false, account: Account
|
||||
return .single(nil)
|
||||
}
|
||||
|
||||
return account.postbox.transaction(ignoreDisabled: forIQTP) { transaction -> Signal<RequestChatContextResultsResult?, RequestChatContextResultsError> in
|
||||
return account.postbox.transaction { transaction -> Signal<RequestChatContextResultsResult?, RequestChatContextResultsError> in
|
||||
var staleResult: RequestChatContextResultsResult?
|
||||
|
||||
if offset.isEmpty && location == nil {
|
||||
@@ -139,7 +139,7 @@ func _internal_requestChatContextResults(forIQTP: Bool = false, account: Account
|
||||
return .single(nil)
|
||||
}
|
||||
|
||||
return account.postbox.transaction(ignoreDisabled: forIQTP) { transaction -> RequestChatContextResultsResult? in
|
||||
return account.postbox.transaction { transaction -> RequestChatContextResultsResult? in
|
||||
if result.cacheTimeout > 10, offset.isEmpty && location == nil {
|
||||
if let resultData = try? JSONEncoder().encode(result) {
|
||||
let requestData = RequestData(version: requestVersion, botId: botId, peerId: peerId, query: query)
|
||||
|
||||
@@ -361,8 +361,8 @@ public extension TelegramEngine {
|
||||
return _internal_updateStarsReactionIsAnonymous(account: self.account, messageId: id, isAnonymous: isAnonymous)
|
||||
}
|
||||
|
||||
public func requestChatContextResults(forIQTP: Bool = false, botId: PeerId, peerId: PeerId, query: String, location: Signal<(Double, Double)?, NoError> = .single(nil), offset: String, incompleteResults: Bool = false, staleCachedResults: Bool = false) -> Signal<RequestChatContextResultsResult?, RequestChatContextResultsError> {
|
||||
return _internal_requestChatContextResults(forIQTP: Bool = false, account: self.account, botId: botId, peerId: peerId, query: query, location: location, offset: offset, incompleteResults: incompleteResults, staleCachedResults: staleCachedResults)
|
||||
public func requestChatContextResults(botId: PeerId, peerId: PeerId, query: String, location: Signal<(Double, Double)?, NoError> = .single(nil), offset: String, incompleteResults: Bool = false, staleCachedResults: Bool = false) -> Signal<RequestChatContextResultsResult?, RequestChatContextResultsError> {
|
||||
return _internal_requestChatContextResults(account: self.account, botId: botId, peerId: peerId, query: query, location: location, offset: offset, incompleteResults: incompleteResults, staleCachedResults: staleCachedResults)
|
||||
}
|
||||
|
||||
public func removeRecentlyUsedHashtag(string: String) -> Signal<Void, NoError> {
|
||||
|
||||
@@ -179,7 +179,7 @@ public extension TelegramEngine {
|
||||
return _internal_inactiveChannelList(network: self.account.network)
|
||||
}
|
||||
|
||||
public func resolvePeerByName(forIQTP: Bool = false, name: String, referrer: String?, ageLimit: Int32 = 2 * 60 * 60 * 24) -> Signal<ResolvePeerResult, NoError> {
|
||||
public func resolvePeerByName(name: String, referrer: String?, ageLimit: Int32 = 2 * 60 * 60 * 24) -> Signal<ResolvePeerResult, NoError> {
|
||||
return _internal_resolvePeerByName(account: self.account, name: name, referrer: referrer, ageLimit: ageLimit)
|
||||
|> mapToSignal { result -> Signal<ResolvePeerResult, NoError> in
|
||||
switch result {
|
||||
@@ -189,7 +189,7 @@ public extension TelegramEngine {
|
||||
guard let peerId = peerId else {
|
||||
return .single(.result(nil))
|
||||
}
|
||||
return self.account.postbox.transaction(ignoreDisabled: forIQTP) { transaction -> ResolvePeerResult in
|
||||
return self.account.postbox.transaction { transaction -> ResolvePeerResult in
|
||||
return .result(transaction.getPeer(peerId).flatMap(EnginePeer.init))
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user