mirror of
https://github.com/Swiftgram/Telegram-iOS.git
synced 2025-12-24 07:05:35 +00:00
Merge branch 'master' of gitlab.com:peter-iakovlev/telegram-ios
This commit is contained in:
@@ -2279,8 +2279,8 @@ public extension TelegramEngine.EngineData.Item {
|
||||
}
|
||||
}
|
||||
|
||||
public struct StarsReactionDefaultToPrivate: TelegramEngineDataItem, PostboxViewDataItem {
|
||||
public typealias Result = Bool
|
||||
public struct StarsReactionDefaultPrivacy: TelegramEngineDataItem, PostboxViewDataItem {
|
||||
public typealias Result = TelegramPaidReactionPrivacy
|
||||
|
||||
public init() {
|
||||
}
|
||||
@@ -2291,9 +2291,9 @@ public extension TelegramEngine.EngineData.Item {
|
||||
|
||||
func extract(view: PostboxView) -> Result {
|
||||
if let value = (view as? CachedItemView)?.value?.get(StarsReactionDefaultToPrivateData.self) {
|
||||
return value.isPrivate
|
||||
return value.privacy
|
||||
} else {
|
||||
return false
|
||||
return .default
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -337,8 +337,8 @@ public extension TelegramEngine {
|
||||
).startStandalone()
|
||||
}
|
||||
|
||||
public func sendStarsReaction(id: EngineMessage.Id, count: Int, isAnonymous: Bool?) -> Signal<Bool, NoError> {
|
||||
return _internal_sendStarsReactionsInteractively(account: self.account, messageId: id, count: count, isAnonymous: isAnonymous)
|
||||
public func sendStarsReaction(id: EngineMessage.Id, count: Int, privacy: TelegramPaidReactionPrivacy?) -> Signal<TelegramPaidReactionPrivacy, NoError> {
|
||||
return _internal_sendStarsReactionsInteractively(account: self.account, messageId: id, count: count, privacy: privacy)
|
||||
}
|
||||
|
||||
public func cancelPendingSendStarsReaction(id: EngineMessage.Id) {
|
||||
@@ -349,8 +349,8 @@ public extension TelegramEngine {
|
||||
let _ = _internal_forceSendPendingSendStarsReaction(account: self.account, messageId: id).startStandalone()
|
||||
}
|
||||
|
||||
public func updateStarsReactionIsAnonymous(id: EngineMessage.Id, isAnonymous: Bool) -> Signal<Never, NoError> {
|
||||
return _internal_updateStarsReactionIsAnonymous(account: self.account, messageId: id, isAnonymous: isAnonymous)
|
||||
public func updateStarsReactionPrivacy(id: EngineMessage.Id, privacy: TelegramPaidReactionPrivacy) -> Signal<Never, NoError> {
|
||||
return _internal_updateStarsReactionPrivacy(account: self.account, messageId: id, privacy: privacy)
|
||||
}
|
||||
|
||||
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> {
|
||||
|
||||
@@ -95,6 +95,42 @@ public final class TelegramResolvedMessageLink {
|
||||
}
|
||||
}
|
||||
|
||||
public enum TelegramPaidReactionPrivacy: Equatable, Codable {
|
||||
case `default`
|
||||
case anonymous
|
||||
case peer(PeerId)
|
||||
|
||||
enum CodingKeys: String, CodingKey {
|
||||
case `default` = "d"
|
||||
case anonymous = "a"
|
||||
case peer = "p"
|
||||
}
|
||||
|
||||
public init(from decoder: any Decoder) throws {
|
||||
let container = try decoder.container(keyedBy: CodingKeys.self)
|
||||
if try container.decodeNil(forKey: .default) {
|
||||
self = .default
|
||||
} else if try container.decodeNil(forKey: .anonymous) {
|
||||
self = .anonymous
|
||||
} else {
|
||||
let peerId = PeerId(try container.decode(Int64.self, forKey: .peer))
|
||||
self = .peer(peerId)
|
||||
}
|
||||
}
|
||||
|
||||
public func encode(to encoder: any Encoder) throws {
|
||||
var container = encoder.container(keyedBy: CodingKeys.self)
|
||||
switch self {
|
||||
case .default:
|
||||
try container.encodeNil(forKey: .default)
|
||||
case .anonymous:
|
||||
try container.encodeNil(forKey: .anonymous)
|
||||
case let .peer(peerId):
|
||||
try container.encode(peerId.toInt64(), forKey: .peer)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public extension TelegramEngine {
|
||||
enum NextUnreadChannelLocation: Equatable {
|
||||
case same
|
||||
@@ -1650,9 +1686,9 @@ public extension TelegramEngine {
|
||||
}
|
||||
}
|
||||
|
||||
public func setStarsReactionDefaultToPrivate(isPrivate: Bool) {
|
||||
public func setStarsReactionDefaultPrivacy(privacy: TelegramPaidReactionPrivacy) {
|
||||
let _ = self.account.postbox.transaction({ transaction in
|
||||
_internal_setStarsReactionDefaultToPrivate(isPrivate: isPrivate, transaction: transaction)
|
||||
_internal_setStarsReactionDefaultPrivacy(privacy: privacy, transaction: transaction)
|
||||
}).startStandalone()
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user