mirror of
https://github.com/Swiftgram/Telegram-iOS.git
synced 2025-06-16 05:55:20 +00:00
macos and other stuff
This commit is contained in:
parent
af00fd8e28
commit
39e8c7bb2e
@ -43,6 +43,18 @@ func _internal_addNoPaidMessagesException(account: Account, peerId: PeerId, refu
|
|||||||
return account.network.request(Api.functions.account.addNoPaidMessagesException(flags: flags, userId: inputUser))
|
return account.network.request(Api.functions.account.addNoPaidMessagesException(flags: flags, userId: inputUser))
|
||||||
|> `catch` { _ -> Signal<Api.Bool, NoError> in
|
|> `catch` { _ -> Signal<Api.Bool, NoError> in
|
||||||
return .single(.boolFalse)
|
return .single(.boolFalse)
|
||||||
|
} |> mapToSignal { _ in
|
||||||
|
return account.postbox.transaction { transaction -> Void in
|
||||||
|
transaction.updatePeerCachedData(peerIds: Set([peerId]), update: { _, cachedData in
|
||||||
|
if let cachedData = cachedData as? CachedUserData {
|
||||||
|
var settings = cachedData.peerStatusSettings ?? .init()
|
||||||
|
settings.paidMessageStars = nil
|
||||||
|
return cachedData.withUpdatedPeerStatusSettings(settings)
|
||||||
|
}
|
||||||
|
return cachedData
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|> ignoreValues
|
||||||
}
|
}
|
||||||
|> ignoreValues
|
|> ignoreValues
|
||||||
}
|
}
|
||||||
|
@ -361,6 +361,40 @@ public extension TelegramEngine.EngineData.Item {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public struct SendPaidMessageStars: TelegramEngineDataItem, TelegramEngineMapKeyDataItem, PostboxViewDataItem {
|
||||||
|
public typealias Result = Optional<StarsAmount>
|
||||||
|
|
||||||
|
fileprivate var id: EnginePeer.Id
|
||||||
|
public var mapKey: EnginePeer.Id {
|
||||||
|
return self.id
|
||||||
|
}
|
||||||
|
|
||||||
|
public init(id: EnginePeer.Id) {
|
||||||
|
self.id = id
|
||||||
|
}
|
||||||
|
|
||||||
|
var key: PostboxViewKey {
|
||||||
|
return .cachedPeerData(peerId: self.id)
|
||||||
|
}
|
||||||
|
|
||||||
|
func extract(view: PostboxView) -> Result {
|
||||||
|
guard let view = view as? CachedPeerDataView else {
|
||||||
|
preconditionFailure()
|
||||||
|
}
|
||||||
|
guard let cachedPeerData = view.cachedPeerData else {
|
||||||
|
return nil
|
||||||
|
}
|
||||||
|
switch cachedPeerData {
|
||||||
|
case let user as CachedUserData:
|
||||||
|
return user.sendPaidMessageStars
|
||||||
|
case let channel as CachedChannelData:
|
||||||
|
return channel.sendPaidMessageStars
|
||||||
|
default:
|
||||||
|
return nil
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
public struct GroupCallDescription: TelegramEngineDataItem, TelegramEngineMapKeyDataItem, PostboxViewDataItem {
|
public struct GroupCallDescription: TelegramEngineDataItem, TelegramEngineMapKeyDataItem, PostboxViewDataItem {
|
||||||
public typealias Result = Optional<EngineGroupCallDescription>
|
public typealias Result = Optional<EngineGroupCallDescription>
|
||||||
|
@ -470,6 +470,24 @@ public extension Message {
|
|||||||
}
|
}
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
|
||||||
|
var derivedDataAttribute: DerivedDataMessageAttribute? {
|
||||||
|
for attribute in self.attributes {
|
||||||
|
if let attribute = attribute as? DerivedDataMessageAttribute {
|
||||||
|
return attribute
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return nil
|
||||||
|
}
|
||||||
|
|
||||||
|
var forwardVideoTimestampAttribute: ForwardVideoTimestampAttribute? {
|
||||||
|
for attribute in self.attributes {
|
||||||
|
if let attribute = attribute as? ForwardVideoTimestampAttribute {
|
||||||
|
return attribute
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return nil
|
||||||
|
}
|
||||||
}
|
}
|
||||||
public extension Message {
|
public extension Message {
|
||||||
var reactionsAttribute: ReactionsMessageAttribute? {
|
var reactionsAttribute: ReactionsMessageAttribute? {
|
||||||
|
@ -1088,7 +1088,9 @@ public final class OngoingGroupCallContext {
|
|||||||
}
|
}
|
||||||
|
|
||||||
func activateIncomingAudio() {
|
func activateIncomingAudio() {
|
||||||
|
#if os(iOS)
|
||||||
self.context.activateIncomingAudio()
|
self.context.activateIncomingAudio()
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user